awacke1 commited on
Commit
c771de6
·
1 Parent(s): 4f1b10a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -13
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
- # Hello World!
13
- Start typing below to see the output.
14
- """)
15
- inp = gr.Textbox(placeholder="What is your name?")
16
- out = gr.Textbox()
 
 
 
 
17
 
18
- inp.change(fn=update,
19
- inputs=inp,
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()