Deploying ML Models As API Using FastAPI
Deploying ML Models As API Using FastAPI
DEPLOYMENT
03/07/2025
Deploying ML-NLP Models
Deployment usually is the last step in any NLP Project Pipeline, to be able to
integrate your NLP model to a web application is quite an important task. There
are many popular frameworks that can be used to do this task such as Flask ,
FastApi, heroku, Streamlit and Django. Django is usually used for large scale
application and takes quite a bit of time to set up .
Flask , FastAPI are usually your go-to for quickly deploying of your model on a
web app
03/07/2025
Flask
03/07/2025
Model deployment
03/07/2025
FAST API
03/07/2025
FastAPI vs Flask:
1. FastAPI is way faster than Flask, not just that it’s also one of the
fastest python modules out there.
2. Unlike Flask, FastAPI provides an easier implementation for Data
Validation to define the specific data type of the data you send.
3. Automatic Docs to call and test your API(Swagger UI and Redoc).
4. FastAPI comes with built-in support for Asyncio, GraphQL and
Websockets.
03/07/2025
Libraries installation
03/07/2025
Creating Basic API using FastAPI
03/07/2025
Tiny code
03/07/2025
Test it…
uvicorn basic-app:app --
reload
03/07/2025
The Chatbot -FLASK Project
03/07/2025
The steps
03/07/2025
Files
03/07/2025
The file structure
1. data.json – The data file which has predefined patterns and responses.
2. trainning.py – In this Python file, we wrote a script to build the model and train
our chatbot.
3. Texts.pkl – This is a pickle file in which we store the words Python object using
Nltk that contains a list of our vocabulary.
4. Labels.pkl – The classes pickle file contains the list of categories(Labels).
5. model.h5 – This is the trained model that contains information about the model
and has weights of the neurons.
6. app.py – This is the flask Python script in which we implemented web-based GUI
for our chatbot. Users can easily interact with the bot.
03/07/2025
Streamlit Library
03/07/2025
Django Popularity
03/07/2025
Features of Django
1. Rapid Development
2. Secure
3. Scalable
4. Fully loaded
5. Versatile
6. Open Source
7. Vast and Supported Community
03/07/2025
Django Installation
03/07/2025
Django Project
03/07/2025
Django project
03/07/2025
Running Django project
03/07/2025
Web- Django
03/07/2025