kaizenflow icon indicating copy to clipboard operation
kaizenflow copied to clipboard

SorrTask780_Simple_Chatbot_with_Redis

Open 11swathi opened this issue 1 year ago • 3 comments

Created a basic conversational chatbot with Redis. It is a Flask web application connected to a Redis server. Redis here is used for caching purposes. It stores and retrieves previously generated responses for the chatbot. I have containerized the project in Docker. I have added the code for the project.

To run the code:

  1. Run docker-compose up --build
  2. Open localhost:8000/ in a web browser

To check the Redis cache:

  1. Once the application in running, open a new terminal and run docker exec -it <redis container name e.g. chatbot-redis> redis-cli
  2. After entering the redis-cli, run command KEYS *

Link the video presentation: Video Presentation - Simple Chatbot with Redis - Swathi Baskaran

Issue: I have successfully built the container, but am facing issues with the port numbers. My app keeps running on a different port. Working on it. Edit: Solved

11swathi avatar Apr 26 '24 20:04 11swathi

I had the same issue. Checkout my issue to see the solution.

By default, Flask wants to run on 127.0.0.1:5000.

In your Dockerfile and compose.yaml, you're exposing port 8000.

In app.py make this change:

# Incorrect
if __name__ == '__main__':
    app.run()

# Correct
if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8000, debug=True)

Now it should work.

Bodarnn avatar Apr 26 '24 21:04 Bodarnn

Thanks @Bodarnn! I was able to fix the port numbers and it is working now.

11swathi avatar May 02 '24 02:05 11swathi

I have added the README file and all the necessary files for project and made the final commit.

11swathi avatar May 11 '24 01:05 11swathi