chatbot / app.py
manasagangotri's picture
Update app.py
60c1a90 verified
raw
history blame
517 Bytes
import gradio as gr
import requests
# Change RASA_URL to the local server
RASA_URL = "http://localhost:5005/webhooks/rest/webhook"
def chat_with_bot(user_message):
response = requests.post(RASA_URL, json={"sender": "user", "message": user_message})
bot_reply = response.json()[0]["text"] if response.json() else "I didn't understand that."
return bot_reply
iface = gr.Interface(fn=chat_with_bot, inputs="text", outputs="text", title="Chatbot")
iface.launch(server_name="0.0.0.0", server_port=7860)