Spaces:
Runtime error
Runtime error
Update ui.py
Browse files
ui.py
CHANGED
@@ -1,20 +1,15 @@
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
|
4 |
-
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
# رابط کاربری
|
11 |
-
interface = gr.Interface(
|
12 |
-
fn=ask_chatbot,
|
13 |
-
inputs="text",
|
14 |
outputs="text",
|
15 |
-
title="
|
16 |
-
description="چتبات بر پایه GPT-Neo"
|
17 |
)
|
18 |
|
19 |
-
|
20 |
-
interface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
|
4 |
+
def chat_with_ai(input_text, mode):
|
5 |
+
response = requests.post("http://localhost:8000/chat", json={"input_text": input_text, "mode": mode})
|
6 |
+
return response.json()["response"]
|
7 |
|
8 |
+
ui = gr.Interface(
|
9 |
+
fn=chat_with_ai,
|
10 |
+
inputs=["text", gr.Radio(["general", "iran", "math"], label="Mode")],
|
|
|
|
|
|
|
|
|
|
|
11 |
outputs="text",
|
12 |
+
title="AI Chat System",
|
|
|
13 |
)
|
14 |
|
15 |
+
ui.launch()
|
|