Up to now, we have seen how to build chatbots using the two methods of TF-IDF and Rasa NLU. Let's expose both of them as APIs. The architecture of this simple chatbot framework will look like this:
This chatbot pipeline illustrates that we can have any User Interface (Slack, Skype, and so on) integrated with the chatbot_api which we exposed . And under the hood we can setup any number of algorithms 'TFIDF' and 'RASA'
Refer to the Packt repository for this chapter (available at https://github.com/PacktPublishing/Python-Deep-Learning-Projects/tree/master/Chapter04) for the API code and look into the chatbot_api.py file. Here, we have implemented a common API that can load both versions of bot, and you can now build a whole framework on top of this.
To execute the serving of the APIs, follow these steps:
- Enter the chapter directory using...