Machine learning chatbot with dialogflow, Jupyter notebook,flask,angular,nodeJS – part1

Last time, we made a titanic project with machine learning. We made the backend with flask and used ML model processed from jupyter notebook. Here, we also use that backend. In case, you didn’t read this, check the series.

Our aim is to make a chatbot for titanic project. What we did in the frontend in previous series, we will do the same but with chatbot. Moreover, in future , we will extend this to a explainable chatbot which we will discuss later.

This is the final output of this series.
Here , we chat in the frontend (Angular) which uses a node backend to communicate(send and receive messages) with dialogflow. Dialogflow uses a flask backend to predict the ML model.

Hence, the steps of this series are delineated below:
1. Create a chatbot architecture in dialogflow
2. Attach the flask backend with dialogflow to get the ML model prediction
3. Make a custom UI for the chatbot
4. Make a node backend to handle all the communication between custom UI and dialogflow .
Also use this node backend to communicate with the flask backend for getting the ML model prediction.

Checkout our online demo
All the codes of this series will be found on git.

Let’s start with step 1:

If you dont have any idea at all about dialogflow , it is highly recommended that you should get some idea about it.
First create a agent in the dialogflow. In our case, we named this ‘Titanic_agent’

Then add a response to the default welcome intent so that the user provide his/her name.

Create a intent to get all the input variables:

Add required parameter and their training phases:
Also don’t forget to enable webhook for the newly created intent. undefined

If you see in the ENTITY column of the ‘Action and parameters‘ the last two parameters dont have system entity. Instead, we created our own custom entity.
Lets create two custom entity named ticket_embark and ticket_price.

Define their values and synonyms

Finally, you can test the chatbot in the dialogflow platform itself.
Check the right side where it is written as ‘Try it now’.

So far we have just created a very simple chatbot.
In the next part, we will use webhook to receive all the input variables and get the prediction from the flask backend and finally show the result to the user in our bot.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s