Torch_chatbot

Ref: https://github.com/RedisAI/redisai-examples

Hello,

Has anyone tried the torch_chatbot and was able to make it run?

I am getting this error at flask run:

Error: Could not locate a Flask application. You did not provide the “FLASK_APP” environment variable, and a “wsgi.py” or “app.py” module was not found in the current directory.

I tried building the image with --build-arg flag and also running with -e flag setting FLASK_APP to [absolute path]/app.py, still did not work.

Any advice is much appreciated.

Kim

Hi Kim, I have ran this in a new machine and were able to do it. Do you mind giving me a bit more info? Are you running it using docker-compose? Docker-compose should copy your local files into the container and it has the file app.py. Flask will take that as the entry point instead of searching for the env variable.

Hi Sherin,

I get the following after a successful build:

(base) admins-MacBook-Pro-2:redisai-examples-master kimnguyen$ docker run -e REDIS_IP=’<Server_IP>’ -p 5000:5000 redisai_chatbot

  • Environment: production

    WARNING: This is a development server. Do not use it in a production deployment.

    Use a production WSGI server instead.

  • Debug mode: off

Usage: flask run [OPTIONS]

Error: Could not locate a Flask application. You did not provide the “FLASK_APP” environment variable, and a “wsgi.py” or “app.py” module was not found in the current directory.

Kim

I mean I used REDIS_IP=‘0.0.0.0:6379’

Hi Kim, I am sorry I was thinking you have had issues with our ChatBotDemo repository before realizing you were talking about example repository. Let me check it and get back to you. The ChatBotDemo repository is a clone of what’s in the example repo but in a better state. Give it a shot in the meantime if that works for you.

Hey Sherin,

The ChatBotDemo built successfully. However:

  1. I am not getting a response when I type in the message. I assume the idea is the bot responds when I enter a message?

  2. The curl command to both localhost:5000/chat (the endpoint) displays the following error:

(base) admins-MacBook-Pro-2:~ kimnguyen$ curl http://localhost:5000 -H “Content-Type: application/json” -d ‘{“message”: “I am crazy”}’

405 Method Not Allowed

Method Not Allowed

The method is not allowed for the requested URL.

  1. The curl command to localhost:5000/chat (the endpoint) displays the following error:*

Hi Kim, Both the UI and the CURL command are working for me. Do you mind telling me what do you see on the terminal after you tried sending a message from the UI? Terminal should say what’s the error (I hope you have used docker-compose to bring up the server as mentioned in the README).
By the URL must be http://localhost:5000/chat (not without “chat” at the end)

Hi Sherin,

Yes I used docker-compose up as indicated in the error log below.

And in the UI, when I type in a message, there is no response.

Kim

Could you take a look at the terminal after you send the message from the UI? The terminal where you brought up the docker-compose up should have some error messages.

After sending “Hello” at the UI, the terminal displays the following:

Looks like the code in your local is not up-to-date. Do you mind doing a pull? Essentially what you should look for is this line where the arguments must be inputs and outputs instead of input and output

Sorry! I don’t have virtualenv installed. New to this computer…
Thanks!

If you have an issue even after the pull (very unlikely but just in case), remove all the existing docker images (docker rmi -f ) and do a fresh docker-compose up

It is working. Thank you!!

Awesome, glad I could help