SabziAi / ui.py
apaxray's picture
Update ui.py
4c671d3 verified
raw
history blame
396 Bytes
import gradio as gr
import requests
def chat_with_ai(input_text, mode):
response = requests.post("http://localhost:8000/chat", json={"input_text": input_text, "mode": mode})
return response.json()["response"]
ui = gr.Interface(
fn=chat_with_ai,
inputs=["text", gr.Radio(["general", "iran", "math"], label="Mode")],
outputs="text",
title="AI Chat System",
)
ui.launch()