shahin-canary commited on
Commit
ac3f0ce
·
1 Parent(s): a32a34b

Add application file

Browse files
Files changed (3) hide show
  1. app.py +34 -0
  2. charctr_cby_dp.png +0 -0
  3. equirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from PIL import Image
3
+
4
+ # Function to show the resized image
5
+ def show_image():
6
+ image_path = "charctr_cby_dp.png"
7
+ image = Image.open(image_path)
8
+ return image
9
+
10
+ # Function to clear the image
11
+ def clear_image():
12
+ return None
13
+
14
+ # Define the interface
15
+ with gr.Blocks() as demo:
16
+ gr.Markdown("<h1 style='text-align:center;'>Gradio App</h1>")
17
+
18
+ # Row for buttons
19
+ with gr.Row():
20
+ show_button = gr.Button("SHOW IMAGE")
21
+ clear_button = gr.Button("CLEAR")
22
+
23
+ # Output area for the image
24
+ with gr.Row():
25
+ output_image = gr.Image(label="Result", type="numpy", elem_id="image_output")
26
+
27
+ # Link buttons to their respective functions
28
+ show_button.click(show_image, outputs=[output_image])
29
+ clear_button.click(clear_image, outputs=[output_image])
30
+
31
+ # Launch the app
32
+ if __name__ == "__main__":
33
+ demo.launch()
34
+ demo.launch(debug=True)
charctr_cby_dp.png ADDED
equirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio==3.0.0
2
+ Pillow==9.0.0