Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,19 +4,14 @@
|
|
4 |
import gradio as gr
|
5 |
import requests
|
6 |
|
7 |
-
RASA_URL
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
|
12 |
def chat_with_bot(user_message):
|
13 |
response = requests.post(RASA_URL, json={"sender": "user", "message": user_message})
|
14 |
-
bot_reply = response.json()
|
15 |
-
|
16 |
-
return bot_reply[0]['text']
|
17 |
-
return "I didn't understand that."
|
18 |
|
19 |
-
|
20 |
-
iface = gr.Interface(fn=chat_with_bot, inputs="text", outputs="text", title="Chat with Rasa Bot")
|
21 |
-
iface.launch(server_name="0.0.0.0", server_port=7860)
|
22 |
|
|
|
|
4 |
import gradio as gr
|
5 |
import requests
|
6 |
|
7 |
+
# Change RASA_URL to the local server
|
8 |
+
RASA_URL = "http://localhost:5005/webhooks/rest/webhook"
|
|
|
|
|
9 |
|
10 |
def chat_with_bot(user_message):
|
11 |
response = requests.post(RASA_URL, json={"sender": "user", "message": user_message})
|
12 |
+
bot_reply = response.json()[0]["text"] if response.json() else "I didn't understand that."
|
13 |
+
return bot_reply
|
|
|
|
|
14 |
|
15 |
+
iface = gr.Interface(fn=chat_with_bot, inputs="text", outputs="text", title="Chatbot")
|
|
|
|
|
16 |
|
17 |
+
iface.launch(server_name="0.0.0.0", server_port=7860)
|