Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,18 @@
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
|
4 |
-
|
5 |
def chatbot_response(user_input: str, history) -> str:
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
demo.launch(server_name="localhost", server_port=4000, show_api=False)
|
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
|
|
|
4 |
def chatbot_response(user_input: str, history) -> str:
|
5 |
+
r = requests.get( # changed to GET
|
6 |
+
f"http://localhost:3000/chat/?query={user_input}"
|
7 |
+
)
|
8 |
+
response = r.json()
|
9 |
+
return response.get("answer", "No answer received from API.")
|
10 |
+
|
11 |
+
demo = gr.ChatInterface(
|
12 |
+
fn=chatbot_response,
|
13 |
+
title="Name of demo goes here",
|
14 |
+
description="Description goes here",
|
15 |
+
type="messages" # new line added
|
16 |
+
)
|
17 |
|
18 |
+
demo.launch(server_name="localhost", server_port=4000, show_api=False)
|