File size: 738 Bytes
b5508e7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from handler import SweetCommander
import gradio as gr

controller = SweetCommander()

with gr.Blocks() as demo:
    history = gr.State([])
    with gr.Row() as row:
        with gr.Column():
            user_name = gr.Textbox(label="Name", placeholder="Enter your name")
            user_input = gr.Textbox(label="Input", placeholder="Enter your message")
            button = gr.Button("Enter")
        with gr.Column():
            output = gr.Textbox(label="Response")

    def guess_letter(user_name, user_input):
        response = controller(user_name, user_input)
        return {
            output: response
        }
    button.click(
        guess_letter, 
        [user_name, user_input],
        [output]
    )
demo.launch()