shahin-canary's picture
Update app.py
d462350 verified
raw
history blame contribute delete
901 Bytes
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)