A Chatbot based on Tensorflow, that answers to questions (resp. input sentences) with famous quotes from the Simpsons. This chatbot is based on a tutorial to contextual chatbots with tensorflow and hosts a REST-API to communicate with it.
Run can train and run this Bot using docker. For this repeat the following steps (assuming your Docker environment is already set up):
- Change to the root directory of this project
- If you want to train the Bot with your own intents, just edit the intents.json file but keep the data structure as it is
- Build the docker image:
docker build -t simpsonsbot:latest .
This will build the docker image including the download of all dependencies and training of the model based on the intents.json file. - Run the container:
docker run --name simpsonsbot simpsonsbot:latest
docker run -d -p 5000:5000 --name vagvag simpsonsbot:latest
If you just want to experiment and use the model trained (training and model files available in this repo) you can just clone this repository, download all dependencies and execute the Flask REST-API via python -m flask run
or python -m flask run --host=0.0.0.0
if the REST-API should listen to external clients (not localhost only) as well.
Below you can see an example on how to request an answer from the Chatbot using its' REST-API.
The REST Client used here is called 'Insomnia' but you could use any other client or browser as you wish.
Below you can see an example of the server output. For every request the received Input and the prediction including the probability for the predicted class is logged.