
deploy machine learning models to real-world web, mobile, or desktop apps via api integration, turning theory into production to deliver data-driven business value, with monitoring and ongoing updates.
Explore static and dynamic model deployment strategies, including shadow, AB evaluation, canary, blue-green, rolling updates, and multi-armed bandit, with emphasis on monitoring, testing, and safe rollouts.
Deploy your machine learning models as APIs using FastAPI and create interactive web apps with Streamlit. Explore API documentation, real-life usage, and gallery examples to turn models into practical applications.
Learn how FastAPI serves as an API bridge between data and applications, implement CRUD operations with HTTP verbs, and use uvicorn and Swagger docs for interactive deployment.
Define path parameters in FastAPI endpoints, validate types with annotations, and use async functions for efficient data handling, including enums and docs for predefined values.
Learn to declare query parameters in FastAPI, distinguish them from path parameters, and implement optional defaults like skip and limit to control endpoint responses.
Define a request body with Pydantic for a student and publish a post endpoint in FastAPI to receive name, age, height, weight, compute BMI, and return the updated model.
Learn how to implement input validations in FastAPI endpoints using annotated, query and path parameters, with optional or required parameters and common validations like max length and numeric ranges.
Learn how to combine path, query, and request body parameters in FastAPI using annotated models, with optional fields and field validations for age and name.
Master form-based data intake and file uploads in FastAPI using annotated form fields for username and password, and the file and upload file approaches with validations and metadata.
Use templates with FastAPI to render a user interface for your api by returning html templates and displaying dynamic data such as a student id, with static css support.
Learn to test a FastAPI app using pi test and http by creating a hello world endpoint, asserting 200 status. Use test clients, import app, and run py test.
Build a weather prediction app by connecting a machine learning model to an API that serves any front end, from HTML to Streamlit, with emphasis on docs and debugging.
Develop a time series forecasting API using a Delhi climate dataset, building a project structure with main.py, model.py, and tests.py, and set up a virtual environment and FastAPI installation.
Build a time series ml model with pandas, prophet, and joblib to train on climate data, generate future predictions, and expose y hat outputs for fastapi deployment.
Create model prediction endpoints with FastAPI, using query parameters for weather variables and days. Handle 400 errors for missing models and verify responses through the docs.
Build a web interface with html templates and an index.html that posts to the /predicts endpoint to display ml model predictions via FastAPI.
Test FastAPI app endpoints using a test client to verify responses, status codes, and HTML content types. Validate the predict endpoint with weather variables like temperature to ensure robust deployment.
Explore Streamlit widgets like sliders, text inputs, checkboxes, and select boxes to manipulate data, with session state and dataframe visualizations.
Learn to design layouts by arranging Streamlit widgets in sidebars and canvases, using st.sidebar for select boxes, sliders, and radio buttons, and st.columns for side-by-side panels.
Learn how caching in Streamlit speeds apps by caching data with st dot catch data for data frames and APIs, and st dot catch resource for static resources.
Explain how Streamlit session state saves values between reruns within a single session, stores items like counters and dataframes, and contrasts with caching across sessions.
Explore multi-page design in Streamlit by organizing pages in a pages folder beside main.py, creating page1.py, page2.py, and page3.py, and refreshing to view navigation.
Build a Streamlit UI integrated with FastAPI to forecast weather, featuring a home page with time-series graphs of humidity and wind speed and a forecast page for temperature.
Create a two-folder project with backend and frontend, set up dependencies in requirements.txt, and implement four climate models with a Streamlit interface.
Connect a FastAPI endpoint with a Streamlit frontend by posting a payload with weather variable and days to get predictions, then display the forecast data.
Deploy the FastAPI on Render as its own web service, set host and port, connect a Git repository, install requirements, and launch the Streamlit app to test predictions.
Deploy a Streamlit app using the Streamlit Community Cloud or Render by linking your GitHub repo, with optional Docker or Kubernetes for scaling, while considering pricing.
Build a WhatsApp image generator using Vonage, FastAPI, and OpenAI, with Ngrok to expose your local server, and generate images from text prompts like yellow mango or big fat monkey.
Set up and activate a virtual environment, create key files (.env, main.py, utilities), prepare a requirements.txt with fast api, uvicorn, openai, requests, and Grock, then install them.
Configure Vonage messaging sandbox, securely manage API key and secret via environment variables, and implement a Python function to send image messages to WhatsApp using the Vonage API.
Learn to connect to the OpenAI API by configuring keys and environment variables, generate images with the OpenAI image endpoint, and integrate URL in a FastAPI app for WhatsApp delivery.
Develop a FastAPI app that receives inbound WhatsApp prompts via Vonage, creates images with OpenAI, and returns them through a webhook, using Ngrok, logging, and environment variables.
Why Deploy Models?
Machine learning models aren't just for show; they're meant to be used in the real world. By deploying your model, you can make it accessible to users who can benefit from its insights and predictions. There are several reasons why you should deploy your model:
1. User Interaction:
Machine learning is not just about building complex models; it's about providing value to users. Deploying your model allows users to interact with your insights through user-friendly interfaces like APIs or web apps, making your work more accessible and impactful.
2. Complex Applications:
Some machine learning models are designed to be used in complex applications such as AI voice assistants, video recommendations, and weather forecasting. Deploying your model enables these applications to leverage their predictions and provide valuable services to users.
3. Scalability and Efficiency:
Deploying your model on a server or cloud platform ensures scalability and efficiency. This allows you to handle a large number of requests simultaneously, ensuring that your model can serve multiple users without compromising performance.
4. Real-Time Predictions:
By deploying your model, you can enable real-time predictions. This is crucial for applications that require immediate responses, such as fraud detection systems or stock trading platforms. Deploying your model allows it to make predictions on the fly, providing users with up-to-date insights.
5. Continuous Improvement:
Deploying your model is not a one-time task. It involves continuous monitoring and improvement. By tracking your model's performance in real-world scenarios, you can identify areas for improvement and make the necessary adjustments to enhance its accuracy and effectiveness.
As you work through this course, consisting of eight sections, you will gain a comprehensive understanding of model deployment, including best practices, different deployment methods, and considerations for various use cases.
Each chapter is designed to achieve specific aims and objectives, equipping you with the knowledge and skills necessary to successfully deploy your machine learning models.
Introduction
In this section, you will delve into the concept of model deployment, exploring its significance and the diverse strategies employed in the process. We will provide a concise overview of FastAPI and Streamlit, shedding light on their distinct purposes and how they contribute to model deployment.
Building APIs with FastAPI
This section dives deep into building APIs with FastAPI, covering essential concepts like handling various parameters, receiving data inputs, and crafting user-friendly interfaces. You'll learn how to create APIs that accept and process diverse data from various sources while ensuring their quality and maintainability through effective testing practices. By the end, you'll be equipped to build robust and scalable APIs, confident in their ability to meet modern web requirements.
ML Models as an API with FastAPI
You will learn how to use FastAPI to create ML model APIs by building a weather model forecast API. You will build a forecast model from scratch and use it for prediction on an API endpoint.
Building Web Applications with Streamlit
In this section, you will be introduced to the basic components of a Streamlit application, including inputs, widgets, and layouts. You will also learn about caching and session management, two important features for building high-performance web applications.
Integrating FastAPI with Streamlit
In this section, you will build the user interface for the weather forecasting model API built in the previous section and also integrate the API with Streamlit.
Deployment
This section will show you how to deploy your Model API and Streamlit application using Render and Streamlit Cloud.
WhatsApp AI Text-to-Image Chatbot
This project will show you how to use your existing FastAPI knowledge with external tools such as Vonage and the DALL-E API to build a WhatsApp chatbot.
Capstone Project
You will showcase the skills you have learned in this course by building a full application that allows real estate agencies to predict house prices using various features.