Spaces:
Runtime error
Runtime error
publichealthsurveillance
commited on
Commit
•
45edeac
1
Parent(s):
47ae8bb
Update app.py
Browse files
app.py
CHANGED
@@ -1,31 +1,3 @@
|
|
1 |
-
import numpy as np
|
2 |
-
import gradio as gr
|
3 |
-
|
4 |
-
demo = gr.Blocks()
|
5 |
-
|
6 |
-
def flip_text(x):
|
7 |
-
return x[::-1]
|
8 |
-
|
9 |
-
def flip_image(x):
|
10 |
-
return np.fliplr(x)
|
11 |
-
|
12 |
-
with demo:
|
13 |
-
gr.Markdown("Flip text or image files using this demo.")
|
14 |
-
with gr.Tabs():
|
15 |
-
with gr.TabItem("Flip Text"):
|
16 |
-
text_input = gr.Textbox()
|
17 |
-
text_output = gr.Textbox()
|
18 |
-
text_button = gr.Button("Flip")
|
19 |
-
with gr.TabItem("Flip Image"):
|
20 |
-
with gr.Row():
|
21 |
-
image_input = gr.Image()
|
22 |
-
image_output = gr.Image()
|
23 |
-
image_button = gr.Button("Flip")
|
24 |
-
|
25 |
-
text_button.click(flip_text, inputs=text_input, outputs=text_output)
|
26 |
-
image_button.click(flip_image, inputs=image_input, outputs=image_output)
|
27 |
-
|
28 |
-
demo.launch()
|
29 |
|
30 |
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
|
2 |
|
3 |
|