0% found this document useful (0 votes)
35 views20 pages

Model Deployment Techniques Overview

Uploaded by

Meghana K S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views20 pages

Model Deployment Techniques Overview

Uploaded by

Meghana K S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Module 8: Model Deployment

• Overview of model deployment techniques


• - Saving models (Pickle/Joblib)
• - Flask/Django
• - Streamlit & FastAPI
• - Cloud Deployment
• - Project: House Price Prediction App
Saving ML/DL Models
• Why save models?
• - Avoid retraining
• - Reusability
• - Deployment ready
Pickle - Saving Models
• Code:
• import pickle
• [Link](model, open('[Link]','wb'))

• Load:
• model = [Link](open('[Link]','rb'))
Pickle Example Output
• Input: [5]
• Output: [10.0]
Joblib - Saving Models
• Code:
• import joblib
• [Link](model,'[Link]')

• Load:
• model = [Link]('[Link]')
Joblib Example Output
• Input: [7]
• Output: [14.0]
Flask for Model Deployment
• Simple Flask API for prediction
• - Lightweight
• - Good for quick APIs
Flask Example Code
• POST /predict
• Input: {"features":[5]}
• Output: {"prediction": [10.0]}
Django for Model Deployment
• Best for larger apps
• - Authentication
• - Database integration
• - Admin interface
Streamlit for Deployment
• Easiest UI framework
• - Python-only
• - Fast prototyping
• - Interactive inputs
Streamlit Example Code
• [Link]('House Price Prediction')
• sqft = st.number_input('Enter sqft')
• [Link]([[sqft]])
FastAPI for Deployment
• Modern, fast API
• - Async support
• - Easy Swagger docs
FastAPI Example Code
• POST /predict
• Input: [1200,3,2]
• Output: {'prediction':[250000]}
Cloud Deployment Basics
• Platforms:
• - AWS (EC2, SageMaker)
• - GCP (App Engine, AI Platform)
• - Azure (App Service, ML Studio)
Deployment Workflow
• Steps:
• 1. Train & Save Model
• 2. Build Flask/Streamlit App
• 3. Containerize with Docker
• 4. Deploy to Cloud
Project: House Price Prediction
• Steps:
• 1. Train regression model
• 2. Save with joblib
• 3. Build Streamlit UI
• 4. Deploy on Cloud
Project Input Example
• User enters:
• - Square feet
• - Bedrooms
• - Bathrooms
Project Output Example
• Prediction: $350,000
Deployment Options
• Local Deployment: streamlit run [Link]
• Cloud Deployment: AWS/GCP/Azure/Heroku
Conclusion
• You learned:
• - Saving models
• - Flask, Django, Streamlit, FastAPI
• - Cloud basics
• - Built a real deployment project

You might also like