Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,33 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
|
4 |
-
language = ''
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
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__":
|