File size: 901 Bytes
ac3f0ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d462350
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import gradio as gr
from PIL import Image

# Function to show the resized image
def show_image():
    image_path = "charctr_cby_dp.png"
    image = Image.open(image_path)
    return image

# Function to clear the image
def clear_image():
    return None

# Define the interface
with gr.Blocks() as demo:
    gr.Markdown("<h1 style='text-align:center;'>Gradio App</h1>")
    
    # Row for buttons
    with gr.Row():
        show_button = gr.Button("SHOW IMAGE")
        clear_button = gr.Button("CLEAR")
    
    # Output area for the image
    with gr.Row():
        output_image = gr.Image(label="Result", type="numpy", elem_id="image_output")

    # Link buttons to their respective functions
    show_button.click(show_image, outputs=[output_image])
    clear_button.click(clear_image, outputs=[output_image])
 
# Launch the app
if __name__ == "__main__": 
    demo.launch(share=True, debug=True)