abidlabs HF Staff commited on
Commit
3e0a841
·
verified ·
1 Parent(s): 877dd0d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -5
app.py CHANGED
@@ -1,10 +1,36 @@
 
1
  import gradio as gr
2
 
3
- def test():
4
- return "Hello"
 
 
 
5
 
6
  with gr.Blocks() as demo:
7
- t = gr.Textbox()
8
- demo.load(test, None, t)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
- demo.launch()
 
 
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("Flip text or image files using this demo.")
12
+ with gr.Tab("Flip Text"):
13
+ text_input = gr.Textbox()
14
+ text_output = gr.Textbox()
15
+ text_button = gr.Button("Flip")
16
+ with gr.Tab("Flip Image"):
17
+ with gr.Row():
18
+ image_input = gr.Image()
19
+ image_output = gr.Image()
20
+ image_button = gr.Button("Flip")
21
+
22
+ with gr.Accordion("Open for More!", open=False):
23
+ gr.Markdown("Look at me...")
24
+ temp_slider = gr.Slider(
25
+ 0, 1,
26
+ value=0.1,
27
+ step=0.1,
28
+ interactive=True,
29
+ label="Slide me",
30
+ )
31
+
32
+ text_button.click(flip_text, inputs=text_input, outputs=text_output)
33
+ image_button.click(flip_image, inputs=image_input, outputs=image_output)
34
 
35
+ if __name__ == "__main__":
36
+ demo.launch()