Spaces:
Sleeping
Sleeping
Update app_gradio.py
Browse files- app_gradio.py +5 -3
app_gradio.py
CHANGED
|
@@ -156,6 +156,8 @@ def process_video(num_frames, num_seeds, generator, exp_dir, load_name, caption,
|
|
| 156 |
return gifs
|
| 157 |
|
| 158 |
def generate_output(image, apply_filter, prompt: str, num_seeds: int = 3, lambda_value: float = 0.5, progress=gr.Progress(track_tqdm=True)) -> List[str]:
|
|
|
|
|
|
|
| 159 |
"""Main function to generate output GIFs"""
|
| 160 |
unique_id = str(uuid.uuid4())
|
| 161 |
exp_dir = f"static/app_tmp_{unique_id}"
|
|
@@ -177,9 +179,9 @@ def generate_output(image, apply_filter, prompt: str, num_seeds: int = 3, lambda
|
|
| 177 |
bottom = top + min_dim
|
| 178 |
image = image.crop((left, top, right, bottom))
|
| 179 |
|
| 180 |
-
# Step 2: Resize to
|
| 181 |
-
if image.size[0] >
|
| 182 |
-
image = image.resize((
|
| 183 |
|
| 184 |
image.save(temp_image_path)
|
| 185 |
|
|
|
|
| 156 |
return gifs
|
| 157 |
|
| 158 |
def generate_output(image, apply_filter, prompt: str, num_seeds: int = 3, lambda_value: float = 0.5, progress=gr.Progress(track_tqdm=True)) -> List[str]:
|
| 159 |
+
if prompt is None:
|
| 160 |
+
raise gr.Error("You forgot to describe the motion !")
|
| 161 |
"""Main function to generate output GIFs"""
|
| 162 |
unique_id = str(uuid.uuid4())
|
| 163 |
exp_dir = f"static/app_tmp_{unique_id}"
|
|
|
|
| 179 |
bottom = top + min_dim
|
| 180 |
image = image.crop((left, top, right, bottom))
|
| 181 |
|
| 182 |
+
# Step 2: Resize to 256 if the image is larger
|
| 183 |
+
if image.size[0] > 256: # Image is square at this point
|
| 184 |
+
image = image.resize((256, 256), Image.LANCZOS)
|
| 185 |
|
| 186 |
image.save(temp_image_path)
|
| 187 |
|