File size: 396 Bytes
dec7a53
 
 
4c671d3
 
 
dec7a53
4c671d3
 
 
dec7a53
4c671d3
dec7a53
 
4c671d3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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()