File size: 740 Bytes
3c9af9e
325df34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import gradio as gr
from gradio_client import Client

# Call the existing model
client = Client("Futuresony/Mr.Events")

def chat_with_model(user_input):
    result = client.predict(
        query=user_input,
        api_name="/chat"
    )
    return result

# Create a better desktop-friendly interface
with gr.Blocks() as demo:
    gr.Markdown("## 💬 Test the ABSA Model Chat")
    with gr.Row():
        with gr.Column(scale=3):
            input_text = gr.Textbox(label="Type your message")
            submit_btn = gr.Button("Send")
        with gr.Column(scale=5):
            output_text = gr.Textbox(label="Model Response", lines=6)

    submit_btn.click(fn=chat_with_model, inputs=input_text, outputs=output_text)

demo.launch()