Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,22 +1,29 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import transformers as tr
|
| 3 |
-
|
| 4 |
-
def update(name):
|
| 5 |
-
return f"Welcome to Gradio, {name}!"
|
| 6 |
|
| 7 |
demo = gr.Blocks()
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
with demo:
|
| 10 |
-
gr.Markdown(
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
outputs=out)
|
| 21 |
|
| 22 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import transformers as tr
|
| 3 |
+
import numpy as np
|
|
|
|
|
|
|
| 4 |
|
| 5 |
demo = gr.Blocks()
|
| 6 |
|
| 7 |
+
def f1(x):
|
| 8 |
+
return x[::-1]
|
| 9 |
+
|
| 10 |
+
def f3(x):
|
| 11 |
+
return np.fliplr(x)
|
| 12 |
+
|
| 13 |
with demo:
|
| 14 |
+
gr.Markdown("Flip text or image files using this demo.")
|
| 15 |
+
with gr.Tabs():
|
| 16 |
+
with gr.TabItem("Flip Text"):
|
| 17 |
+
text_input = gr.Textbox()
|
| 18 |
+
text_output = gr.Textbox()
|
| 19 |
+
text_button = gr.Button("Flip")
|
| 20 |
+
with gr.TabItem("Flip Image"):
|
| 21 |
+
with gr.Row():
|
| 22 |
+
image_input = gr.Image()
|
| 23 |
+
image_output = gr.Image()
|
| 24 |
+
image_button = gr.Button("Flip")
|
| 25 |
|
| 26 |
+
text_button.click(f1, inputs=text_input, outputs=text_output)
|
| 27 |
+
image_button.click(f2, inputs=image_input, outputs=image_output)
|
|
|
|
| 28 |
|
| 29 |
demo.launch()
|