Update app.py
Browse files
app.py
CHANGED
@@ -168,7 +168,23 @@ class AnimateController:
|
|
168 |
_, unexpected = self.unet.load_state_dict(motion_module_state_dict, strict=False)
|
169 |
assert len(unexpected) == 0
|
170 |
return gr.Dropdown.update()
|
|
|
171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
|
173 |
def animate(
|
174 |
self,
|
@@ -200,6 +216,9 @@ class AnimateController:
|
|
200 |
|
201 |
generator = torch.Generator(device="cuda")
|
202 |
generator.manual_seed(seed)
|
|
|
|
|
|
|
203 |
|
204 |
sample = pipeline(
|
205 |
prompt_textbox,
|
|
|
168 |
_, unexpected = self.unet.load_state_dict(motion_module_state_dict, strict=False)
|
169 |
assert len(unexpected) == 0
|
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.thumbnail((new_width, new_height))
|
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(
|
190 |
self,
|
|
|
216 |
|
217 |
generator = torch.Generator(device="cuda")
|
218 |
generator.manual_seed(seed)
|
219 |
+
|
220 |
+
|
221 |
+
init_image = resize_image(init_image, 'resized.png', 512, 512)
|
222 |
|
223 |
sample = pipeline(
|
224 |
prompt_textbox,
|