apaxray commited on
Commit
dec7a53
·
verified ·
1 Parent(s): f065214

Create ui.py

Browse files
Files changed (1) hide show
  1. ui.py +20 -0
ui.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import requests
3
+
4
+ API_URL = "http://localhost:8000/chat/" # تغییر به URL واقعی بک‌اند در آینده
5
+
6
+ def ask_chatbot(query):
7
+ response = requests.post(API_URL, json={"query": query})
8
+ return response.json().get("response", "خطایی رخ داد!")
9
+
10
+ # رابط کاربری
11
+ interface = gr.Interface(
12
+ fn=ask_chatbot,
13
+ inputs="text",
14
+ outputs="text",
15
+ title="ChatGPT Clone",
16
+ description="چت‌بات بر پایه GPT-Neo"
17
+ )
18
+
19
+ if __name__ == "__main__":
20
+ interface.launch()