Spaces:
Running
Running
File size: 633 Bytes
8bb7ee8 401eccd 8bb7ee8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import gradio as gr
from PIL import Image
def resize_image(image, width, height):
image = Image.open(image)
image = image.resize((width, height))
return image
with gr.Blocks() as demo:
gr.Markdown("# 🖼️ Image Scaler")
with gr.Row():
image_input = gr.File(label="Upload Image")
width_input = gr.Number(label="New Width", value=512)
height_input = gr.Number(label="New Height", value=512)
output = gr.Image(label="Resized Image")
btn = gr.Button("Resize Image")
btn.click(fn=resize_image, inputs=[image_input, width_input, height_input], outputs=output)
demo.launch()
|