fffiloni commited on
Commit
bd8cfc7
1 Parent(s): a7d6beb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -111,6 +111,14 @@ def fill_image(image, model_selection):
111
  target_height=1280
112
  overlap=48
113
  fade_width=24
 
 
 
 
 
 
 
 
114
  # Calculate the required height for 9:16 ratio
115
  target_height = (source.width * target_ratio[1]) // target_ratio[0]
116
 
 
111
  target_height=1280
112
  overlap=48
113
  fade_width=24
114
+ max_width = 720
115
+ # Resize the image if it's wider than max_width
116
+ if source.width > max_width:
117
+ scale_factor = max_width / source.width
118
+ new_width = max_width
119
+ new_height = int(source.height * scale_factor)
120
+ source = source.resize((new_width, new_height), Image.LANCZOS)
121
+
122
  # Calculate the required height for 9:16 ratio
123
  target_height = (source.width * target_ratio[1]) // target_ratio[0]
124