Spaces:
Runtime error
Runtime error
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() | |