Spaces:
Running
Running
Upload with huggingface_hub
Browse files
README.md
CHANGED
@@ -5,7 +5,7 @@ emoji: 🔥
|
|
5 |
colorFrom: indigo
|
6 |
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
-
sdk_version: 3.
|
9 |
app_file: run.py
|
10 |
pinned: false
|
11 |
---
|
|
|
5 |
colorFrom: indigo
|
6 |
colorTo: indigo
|
7 |
sdk: gradio
|
8 |
+
sdk_version: 3.10.0
|
9 |
app_file: run.py
|
10 |
pinned: false
|
11 |
---
|
run.py
CHANGED
@@ -1,36 +1,46 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
|
|
|
4 |
def combine(a, b):
|
5 |
return a + " " + b
|
6 |
|
|
|
7 |
def mirror(x):
|
8 |
return x
|
9 |
|
|
|
10 |
with gr.Blocks() as demo:
|
11 |
-
|
12 |
txt = gr.Textbox(label="Input", lines=2)
|
13 |
txt_2 = gr.Textbox(label="Input 2")
|
14 |
txt_3 = gr.Textbox(value="", label="Output")
|
15 |
btn = gr.Button(value="Submit")
|
16 |
btn.click(combine, inputs=[txt, txt_2], outputs=[txt_3])
|
17 |
-
|
18 |
with gr.Row():
|
19 |
im = gr.Image()
|
20 |
im_2 = gr.Image()
|
21 |
-
|
22 |
btn = gr.Button(value="Mirror Image")
|
23 |
btn.click(mirror, inputs=[im], outputs=[im_2])
|
24 |
-
|
25 |
gr.Markdown("## Text Examples")
|
26 |
-
gr.Examples(
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
gr.Markdown("## Image Examples")
|
28 |
gr.Examples(
|
29 |
examples=[os.path.join(os.path.dirname(__file__), "lion.jpg")],
|
30 |
inputs=im,
|
31 |
outputs=im_2,
|
32 |
fn=mirror,
|
33 |
-
cache_examples=True
|
|
|
34 |
|
35 |
if __name__ == "__main__":
|
36 |
demo.launch()
|
|
|
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 |
txt = gr.Textbox(label="Input", lines=2)
|
16 |
txt_2 = gr.Textbox(label="Input 2")
|
17 |
txt_3 = gr.Textbox(value="", label="Output")
|
18 |
btn = gr.Button(value="Submit")
|
19 |
btn.click(combine, inputs=[txt, txt_2], outputs=[txt_3])
|
20 |
+
|
21 |
with gr.Row():
|
22 |
im = gr.Image()
|
23 |
im_2 = gr.Image()
|
24 |
+
|
25 |
btn = gr.Button(value="Mirror Image")
|
26 |
btn.click(mirror, inputs=[im], outputs=[im_2])
|
27 |
+
|
28 |
gr.Markdown("## Text Examples")
|
29 |
+
gr.Examples(
|
30 |
+
[["hi", "Adam"], ["hello", "Eve"]],
|
31 |
+
[txt, txt_2],
|
32 |
+
txt_3,
|
33 |
+
combine,
|
34 |
+
cache_examples=True,
|
35 |
+
)
|
36 |
gr.Markdown("## Image Examples")
|
37 |
gr.Examples(
|
38 |
examples=[os.path.join(os.path.dirname(__file__), "lion.jpg")],
|
39 |
inputs=im,
|
40 |
outputs=im_2,
|
41 |
fn=mirror,
|
42 |
+
cache_examples=True,
|
43 |
+
)
|
44 |
|
45 |
if __name__ == "__main__":
|
46 |
demo.launch()
|