wenjiao commited on
Commit
eacf5fc
·
1 Parent(s): 6bbe804

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -8
app.py CHANGED
@@ -1,19 +1,33 @@
1
  import gradio as gr
2
  import os
3
 
4
- language = ''
5
 
6
- md = "test"
7
- CN_md = "测试"
 
 
 
 
8
 
9
 
10
  with gr.Blocks() as demo:
11
- gr.Markdown(md, _js="""
12
- () => {
13
- language = navigator.language;
14
- }""")
15
- gr.Markdown(language)
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
 
19
  if __name__ == "__main__":
 
1
  import gradio as gr
2
  import os
3
 
 
4
 
5
+ def combine(a, b):
6
+ return a + " " + b
7
+
8
+
9
+ def mirror(x):
10
+ return x
11
 
12
 
13
  with gr.Blocks() as demo:
 
 
 
 
 
14
 
15
+ change_language_radio = gr.Radio(["Chinese", "English"])
16
+ language = gr.Textbox(label="Language")
17
+ txt = gr.Textbox(label="Input", lines=2)
18
+ txt_2 = gr.Textbox(label="Input 2")
19
+ txt_3 = gr.Textbox(value="", label="Output")
20
+ btn = gr.Button(value="Submit")
21
+ btn.click(combine, inputs=[txt, txt_2], outputs=[txt_3])
22
+
23
+ with gr.Row():
24
+ im = gr.Image()
25
+ im_2 = gr.Image()
26
+
27
+ btn = gr.Button(value="Mirror Image")
28
+ btn.click(mirror, inputs=[im], outputs=[im_2])
29
+
30
+ change_language_radio.change(None, [], [language], _js="() => navigator.language")
31
 
32
 
33
  if __name__ == "__main__":