Spaces:
Paused
Paused
Update app_gradio.py
Browse files- app_gradio.py +18 -8
app_gradio.py
CHANGED
@@ -155,7 +155,7 @@ def process_video(num_frames, num_seeds, generator, exp_dir, load_name, caption,
|
|
155 |
|
156 |
return gifs
|
157 |
|
158 |
-
def generate_output(image, 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 |
exp_dir = "static/app_tmp"
|
161 |
os.makedirs(exp_dir, exist_ok=True)
|
@@ -174,15 +174,19 @@ def generate_output(image, prompt: str, num_seeds: int = 3, lambda_value: float
|
|
174 |
caption=prompt,
|
175 |
lambda_=1 - lambda_value
|
176 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
|
178 |
-
|
179 |
-
filtered_gifs = filter(generated_gifs, temp_image_path)
|
180 |
-
|
181 |
-
return filtered_gifs
|
182 |
|
183 |
-
def generate_output_from_sketchpad(image, prompt: str, num_seeds: int = 3, lambda_value: float = 0.5, progress=gr.Progress(track_tqdm=True)):
|
184 |
image = image['composite']
|
185 |
-
results = generate_output(image, prompt, num_seeds, lambda_value)
|
186 |
return results
|
187 |
|
188 |
css=""" """
|
@@ -303,6 +307,11 @@ with gr.Blocks(css=css) as demo:
|
|
303 |
step=0.1,
|
304 |
label="Motion Strength"
|
305 |
)
|
|
|
|
|
|
|
|
|
|
|
306 |
|
307 |
sketchpad_generate_btn = gr.Button(
|
308 |
"Generate Animation",
|
@@ -357,7 +366,8 @@ with gr.Blocks(css=css) as demo:
|
|
357 |
draw_sketchpad,
|
358 |
draw_motion_prompt,
|
359 |
draw_num_seeds,
|
360 |
-
draw_lambda_
|
|
|
361 |
],
|
362 |
outputs=output_gallery
|
363 |
)
|
|
|
155 |
|
156 |
return gifs
|
157 |
|
158 |
+
def generate_output(image, prompt: str, num_seeds: int = 3, lambda_value: float = 0.5, apply_filer: bool = True, progress=gr.Progress(track_tqdm=True)) -> List[str]:
|
159 |
"""Main function to generate output GIFs"""
|
160 |
exp_dir = "static/app_tmp"
|
161 |
os.makedirs(exp_dir, exist_ok=True)
|
|
|
174 |
caption=prompt,
|
175 |
lambda_=1 - lambda_value
|
176 |
)
|
177 |
+
|
178 |
+
if apply_filter:
|
179 |
+
# Apply filtering (assuming filter function is imported)
|
180 |
+
filtered_gifs = filter(generated_gifs, temp_image_path)
|
181 |
+
results = filtered_gifs
|
182 |
+
else:
|
183 |
+
results = generated_gifs
|
184 |
|
185 |
+
return results
|
|
|
|
|
|
|
186 |
|
187 |
+
def generate_output_from_sketchpad(image, prompt: str, num_seeds: int = 3, lambda_value: float = 0.5, apply_filer: bool = True, progress=gr.Progress(track_tqdm=True)):
|
188 |
image = image['composite']
|
189 |
+
results = generate_output(image, prompt, num_seeds, lambda_value, apply_filter)
|
190 |
return results
|
191 |
|
192 |
css=""" """
|
|
|
307 |
step=0.1,
|
308 |
label="Motion Strength"
|
309 |
)
|
310 |
+
apply_filter = gr.Checkbox(
|
311 |
+
label="Apply GIFs Filters",
|
312 |
+
info="If checked, bad/off results will be filtered",
|
313 |
+
value=True
|
314 |
+
)
|
315 |
|
316 |
sketchpad_generate_btn = gr.Button(
|
317 |
"Generate Animation",
|
|
|
366 |
draw_sketchpad,
|
367 |
draw_motion_prompt,
|
368 |
draw_num_seeds,
|
369 |
+
draw_lambda_,
|
370 |
+
apply_filter
|
371 |
],
|
372 |
outputs=output_gallery
|
373 |
)
|