File size: 541 Bytes
dec7a53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
import requests

API_URL = "http://localhost:8000/chat/"  # تغییر به URL واقعی بک‌اند در آینده

def ask_chatbot(query):
    response = requests.post(API_URL, json={"query": query})
    return response.json().get("response", "خطایی رخ داد!")

# رابط کاربری
interface = gr.Interface(
    fn=ask_chatbot,
    inputs="text",
    outputs="text",
    title="ChatGPT Clone",
    description="چت‌بات بر پایه GPT-Neo"
)

if __name__ == "__main__":
    interface.launch()