SabziAi / ui.py
apaxray's picture
Create ui.py
dec7a53 verified
raw
history blame
541 Bytes
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()