MedoHamdani commited on
Commit
8bb7ee8
·
verified ·
1 Parent(s): 2dae5db

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from PIL import Image
3
+
4
+ def resize_image(image, width, height):
5
+ image = Image.open(image)
6
+ image = image.resize((width, height))
7
+ return image
8
+
9
+ with gr.Blocks() as demo:
10
+ gr.Markdown("# 🖼️ Image Scaler")
11
+ with gr.Row():
12
+ image_input = gr.File(label="Upload Image")
13
+ width_input = gr.Number(label="New Width", value=512)
14
+ height_input = gr.Number(label="New Height", value=512)
15
+
16
+ output = gr.Image(label="Resized Image")
17
+
18
+ btn = gr.Button("Resize Image")
19
+ btn.click(fn=resize_image, inputs=[image_input, width_input, height_input], outputs=output)
20
+
21
+ demo.launch()