Spaces:
Running
Running
Add Convert & Clear Button
Browse files
app.py
CHANGED
@@ -15,12 +15,19 @@ theme = gr.themes.Soft(font=font)
|
|
15 |
|
16 |
with gr.Blocks(title=title, theme=theme) as app:
|
17 |
gr.Markdown("# 簡繁轉換小工具 OpenCC Converter")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
with gr.Row():
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
out_text = gr.TextArea(label="輸出文字", show_copy_button=True)
|
23 |
-
options = gr.Dropdown(rev_config_keys, value=rev_config_keys[0], label="轉換選項")
|
24 |
gr.Markdown("Powered By [OpenCC](https://github.com/BYVoid/OpenCC)")
|
25 |
|
26 |
def convert(inn, opt):
|
@@ -31,6 +38,7 @@ with gr.Blocks(title=title, theme=theme) as app:
|
|
31 |
kwargs = {"show_progress": "hidden", "queue": False}
|
32 |
inn_text.change(*args, **kwargs)
|
33 |
options.change(*args, **kwargs)
|
|
|
34 |
|
35 |
|
36 |
app.launch(favicon_path="icon.png")
|
|
|
15 |
|
16 |
with gr.Blocks(title=title, theme=theme) as app:
|
17 |
gr.Markdown("# 簡繁轉換小工具 OpenCC Converter")
|
18 |
+
|
19 |
+
with gr.Box():
|
20 |
+
with gr.Row():
|
21 |
+
with gr.Column():
|
22 |
+
inn_text = gr.TextArea(label="輸入文字", show_copy_button=True)
|
23 |
+
with gr.Column():
|
24 |
+
out_text = gr.TextArea(label="輸出文字", show_copy_button=True)
|
25 |
+
options = gr.Dropdown(rev_config_keys, value=rev_config_keys[0], label="轉換選項")
|
26 |
+
|
27 |
with gr.Row():
|
28 |
+
conv_btn = gr.Button("轉換")
|
29 |
+
clear = gr.ClearButton([inn_text, out_text], value="清除")
|
30 |
+
|
|
|
|
|
31 |
gr.Markdown("Powered By [OpenCC](https://github.com/BYVoid/OpenCC)")
|
32 |
|
33 |
def convert(inn, opt):
|
|
|
38 |
kwargs = {"show_progress": "hidden", "queue": False}
|
39 |
inn_text.change(*args, **kwargs)
|
40 |
options.change(*args, **kwargs)
|
41 |
+
conv_btn.click(*args, **kwargs)
|
42 |
|
43 |
|
44 |
app.launch(favicon_path="icon.png")
|