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