Spaces:
Running
Running
Add application file
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
def flip_text(x):
|
5 |
+
return x[::-1]
|
6 |
+
|
7 |
+
def flip_image(x):
|
8 |
+
return np.fliplr(x)
|
9 |
+
|
10 |
+
with gr.Blocks() as demo:
|
11 |
+
gr.Markdown("My AI interface")
|
12 |
+
with gr.Tab("Single models"):
|
13 |
+
text_input = gr.Textbox()
|
14 |
+
text_output = gr.Textbox()
|
15 |
+
text_button = gr.Button("Flip")
|
16 |
+
with gr.Tab("Multi models"):
|
17 |
+
with gr.Row():
|
18 |
+
image_input = gr.Image()
|
19 |
+
image_output = gr.Image()
|
20 |
+
image_button = gr.Button("Flip")
|
21 |
+
|
22 |
+
text_button.click(flip_text, inputs=text_input, outputs=text_output)
|
23 |
+
image_button.click(flip_image, inputs=image_input, outputs=image_output)
|
24 |
+
|
25 |
+
demo.launch()
|