Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from handler import SweetCommander
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
controller = SweetCommander()
|
5 |
+
|
6 |
+
with gr.Blocks() as demo:
|
7 |
+
history = gr.State([])
|
8 |
+
with gr.Row() as row:
|
9 |
+
with gr.Column():
|
10 |
+
user_name = gr.Textbox(label="Name", placeholder="Enter your name")
|
11 |
+
user_input = gr.Textbox(label="Input", placeholder="Enter your message")
|
12 |
+
button = gr.Button("Enter")
|
13 |
+
with gr.Column():
|
14 |
+
output = gr.Textbox(label="Response")
|
15 |
+
|
16 |
+
def guess_letter(user_name, user_input):
|
17 |
+
response = controller(user_name, user_input)
|
18 |
+
return {
|
19 |
+
output: response
|
20 |
+
}
|
21 |
+
button.click(
|
22 |
+
guess_letter,
|
23 |
+
[user_name, user_input],
|
24 |
+
[output]
|
25 |
+
)
|
26 |
+
demo.launch()
|