jasvir-singh1021 commited on
Commit
9fe71e3
·
verified ·
1 Parent(s): facffbf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import gradio as gr
2
- from PIL import Image, ImageEnhance
3
 
4
  def composite_images(bg_image, overlay_image, x, y, scale, transparency, flip, grayscale):
5
  if bg_image is None or overlay_image is None:
@@ -17,7 +17,7 @@ def composite_images(bg_image, overlay_image, x, y, scale, transparency, flip, g
17
 
18
  # Resize overlay
19
  new_size = (int(overlay.width * scale), int(overlay.height * scale))
20
- overlay = overlay.resize(new_size, Image.ANTIALIAS)
21
 
22
  # Adjust transparency
23
  alpha = int(255 * transparency)
@@ -55,7 +55,6 @@ with gr.Blocks() as demo:
55
  run_btn = gr.Button("Generate Composite")
56
  download_btn = gr.Button("Download")
57
 
58
- # Function linking
59
  run_btn.click(
60
  composite_images,
61
  inputs=[bg_input, overlay_input, x, y, scale, transparency, flip, grayscale],
 
1
  import gradio as gr
2
+ from PIL import Image
3
 
4
  def composite_images(bg_image, overlay_image, x, y, scale, transparency, flip, grayscale):
5
  if bg_image is None or overlay_image is None:
 
17
 
18
  # Resize overlay
19
  new_size = (int(overlay.width * scale), int(overlay.height * scale))
20
+ overlay = overlay.resize(new_size, resample=Image.LANCZOS) # ✅ FIXED here
21
 
22
  # Adjust transparency
23
  alpha = int(255 * transparency)
 
55
  run_btn = gr.Button("Generate Composite")
56
  download_btn = gr.Button("Download")
57
 
 
58
  run_btn.click(
59
  composite_images,
60
  inputs=[bg_input, overlay_input, x, y, scale, transparency, flip, grayscale],