Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -229,11 +229,20 @@ def update_time_required(max_duration_s, rc_str):
|
|
| 229 |
|
| 230 |
return gr.update(value=f"⌚ Zero GPU Required: ~{duration_s}.0s ({duration_m:.1f} mins)")
|
| 231 |
|
| 232 |
-
def
|
| 233 |
-
|
| 234 |
-
return calculate_time_required(max_duration_s, rc_bool)
|
| 235 |
|
| 236 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
def _animate(input_video, max_duration_s, edited_frame, rc_bool, session_id = None, progress=gr.Progress(track_tqdm=True),):
|
| 238 |
|
| 239 |
if session_id is None:
|
|
@@ -481,7 +490,7 @@ with gr.Blocks(css=css, title="Wan 2.2 Animate --replace", theme=gr.themes.Ocean
|
|
| 481 |
</div>
|
| 482 |
""")
|
| 483 |
input_video = gr.Video(label="Input Video", height=512)
|
| 484 |
-
max_duration_slider = gr.Slider(2,
|
| 485 |
|
| 486 |
gr.Examples(
|
| 487 |
examples=[
|
|
@@ -604,7 +613,7 @@ with gr.Blocks(css=css, title="Wan 2.2 Animate --replace", theme=gr.themes.Ocean
|
|
| 604 |
)
|
| 605 |
|
| 606 |
action_button.click(fn=animate_scene, inputs=[input_video, max_duration_slider, edited_frame, replace_character_string, session_state], outputs=[output_video, pose_video, bg_video, mask_video, face_video])
|
| 607 |
-
max_duration_slider.change(
|
| 608 |
replace_character_string.change(update_time_required, inputs=[max_duration_slider, replace_character_string], outputs=[time_required])
|
| 609 |
|
| 610 |
if __name__ == "__main__":
|
|
|
|
| 229 |
|
| 230 |
return gr.update(value=f"⌚ Zero GPU Required: ~{duration_s}.0s ({duration_m:.1f} mins)")
|
| 231 |
|
| 232 |
+
def log_slider_change():
|
| 233 |
+
print("slider value changed")
|
|
|
|
| 234 |
|
| 235 |
+
def get_duration(input_video, max_duration_s, edited_frame, rc_bool, session_id, progress):
|
| 236 |
+
if max_duration_s == 2:
|
| 237 |
+
return 120
|
| 238 |
+
elif max_duration_s == 4:
|
| 239 |
+
return 180
|
| 240 |
+
elif max_duration_s == 6:
|
| 241 |
+
return 240
|
| 242 |
+
elif max_duration_s == 8:
|
| 243 |
+
return 300
|
| 244 |
+
|
| 245 |
+
@spaces.GPU(duration=get_duration)
|
| 246 |
def _animate(input_video, max_duration_s, edited_frame, rc_bool, session_id = None, progress=gr.Progress(track_tqdm=True),):
|
| 247 |
|
| 248 |
if session_id is None:
|
|
|
|
| 490 |
</div>
|
| 491 |
""")
|
| 492 |
input_video = gr.Video(label="Input Video", height=512)
|
| 493 |
+
max_duration_slider = gr.Slider(2, 4, 2, step=2, label="Max Duration", visible=False)
|
| 494 |
|
| 495 |
gr.Examples(
|
| 496 |
examples=[
|
|
|
|
| 613 |
)
|
| 614 |
|
| 615 |
action_button.click(fn=animate_scene, inputs=[input_video, max_duration_slider, edited_frame, replace_character_string, session_state], outputs=[output_video, pose_video, bg_video, mask_video, face_video])
|
| 616 |
+
max_duration_slider.change(log_slider_change)
|
| 617 |
replace_character_string.change(update_time_required, inputs=[max_duration_slider, replace_character_string], outputs=[time_required])
|
| 618 |
|
| 619 |
if __name__ == "__main__":
|