Build An NLP Project From Zero To Hero (6): Model Integration
Feb 13, 2022
Successfully training a machine learning model is just the beginning. Integrating it into a business application is a whole new challenge. In this article, we will be introducing the notion of ML Model Integration and we will give a simple demonstration of the concept: We are building a web service that will be implemented with FastAPI, high performance, and easy to learn Python Web Framework. The service will include the trained Spacy NER Transformer Model in its API. We will also use the Twitter API to simulate getting live data.
Model Integration refers to the concept of adding Machine Learning Models as a feature for production software. And it is well known that this step is the most challenging in the Machine Learning Project Workflow. According to this survey from Statista, around 54% of organizations take more than a month to actually deploy their model in the year 2021.
First, we will explain briefly how to start with the Twitter Developers API and then we will elaborate on the web service structure and ends with a small demo.
Starting with the Twitter Developer API
If you are new to the concept of APIs or Application Programming Interface, we define them as a connection between computers or between computer programs. Here, we want to establish a connection between our own web service and the Twitter API, which will provide us with useful data.
First, follow the steps in this guide.
After successfully creating an application with the Twitter API, copy and save, to a safe location, the credentials details: your API Key, your API Secret Key, your Bearer Token, your Access Token, and your Secret Access Token. In case you missed them during the configuration of your application, you can find them at the ‘Keys and tokens’ tab on your project page in the Twitter Developer Portal.

Twitter Developer Portal
Then, we can make a testing request with Postman to check if the project configuration is working. Postman is an API platform for building and using APIs. Create an account and download the desktop application.
Now, we need to make an environment within Postman that includes all our credentials by default (and so we do not need to add them to every request), create one, and make sure that the variables have the same values as the picture below as well as copying their values (the different credentials) in both initial and current value fields:
