fffiloni commited on
Commit
d6cc5e8
1 Parent(s): 60599d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -16
app.py CHANGED
@@ -170,20 +170,7 @@ class AnimateController:
170
  return gr.Dropdown.update()
171
 
172
 
173
- def resize_image(input_path, output_path, new_width, new_height):
174
-
175
- # Open the image
176
- image = Image.open(input_path)
177
-
178
- # Resize the image while maintaining the aspect ratio
179
- image.resize((new_width, new_height), Image.LANCZOS)
180
-
181
- # Save the resized image to the specified output path
182
- image.save(output_path)
183
-
184
- print("Image resized and saved successfully.")
185
- return output_path
186
-
187
 
188
 
189
  def animate(
@@ -218,11 +205,18 @@ class AnimateController:
218
  generator.manual_seed(seed)
219
 
220
 
221
- init_image = self.resize_image(init_image, 'resized.png', 512, 512)
 
 
 
 
 
 
 
222
 
223
  sample = pipeline(
224
  prompt_textbox,
225
- init_image = init_image,
226
  negative_prompt = negative_prompt_textbox,
227
  num_inference_steps = 25,
228
  guidance_scale = 8.,
 
170
  return gr.Dropdown.update()
171
 
172
 
173
+
 
 
 
 
 
 
 
 
 
 
 
 
 
174
 
175
 
176
  def animate(
 
205
  generator.manual_seed(seed)
206
 
207
 
208
+ # Open the image
209
+ image = Image.open(init_image)
210
+
211
+ # Resize the image while maintaining the aspect ratio
212
+ image.resize((new_width, new_height), Image.LANCZOS)
213
+
214
+ # Save the resized image to the specified output path
215
+ image.save("resized.png")
216
 
217
  sample = pipeline(
218
  prompt_textbox,
219
+ init_image = "resized.png",
220
  negative_prompt = negative_prompt_textbox,
221
  num_inference_steps = 25,
222
  guidance_scale = 8.,