ChenyuRabbitLove
commited on
Commit
•
ea41743
1
Parent(s):
ec231e6
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
category = [
|
4 |
+
'N(數與量)',
|
5 |
+
'S(空間與形狀)',
|
6 |
+
'G(座標幾何)',
|
7 |
+
'R(關係)',
|
8 |
+
'A(代數)',
|
9 |
+
'F(函數)',
|
10 |
+
'D(資料與不確定性)',
|
11 |
+
]
|
12 |
+
|
13 |
+
with gr.Blocks() as demo:
|
14 |
+
input_text = gr.Textbox()
|
15 |
+
|
16 |
+
@gr.render(inputs=input_text)
|
17 |
+
def show_split(text):
|
18 |
+
if len(text) == 0:
|
19 |
+
gr.Markdown("## No Input Provided")
|
20 |
+
gr.Dropdown(category)
|
21 |
+
else:
|
22 |
+
for letter in text:
|
23 |
+
with gr.Row():
|
24 |
+
text = gr.Textbox(letter)
|
25 |
+
btn = gr.Button("Clear")
|
26 |
+
btn.click(lambda: gr.Textbox(value=""), None, text)
|