Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
ddf693e
1
Parent(s):
66f66f4
Update app.py
Browse files
app.py
CHANGED
|
@@ -125,7 +125,7 @@ def calculate_fps(input_video, batch_size):
|
|
| 125 |
print("total vid duration", total_vid_duration)
|
| 126 |
print("frames to process", frames_to_process)
|
| 127 |
print("batch size", batch_size)
|
| 128 |
-
return frames, batch_size, frames_to_process
|
| 129 |
|
| 130 |
def preprocess_and_invert(input_video,
|
| 131 |
frames,
|
|
@@ -192,7 +192,7 @@ def preprocess_and_invert(input_video,
|
|
| 192 |
inverted_latents = gr.State(value=total_inverted_latents)
|
| 193 |
do_inversion = False
|
| 194 |
|
| 195 |
-
return frames, latents, inverted_latents, do_inversion, preprocess_config['batch_size'], preprocess_config['n_frames']
|
| 196 |
|
| 197 |
|
| 198 |
def edit_with_pnp(input_video,
|
|
@@ -371,7 +371,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 371 |
input_video.upload(
|
| 372 |
fn = reset_do_inversion,
|
| 373 |
outputs = [do_inversion],
|
| 374 |
-
queue = False).then(fn = calculate_fps, inputs=[input_video], outputs=[frames, batch_size, n_frames], queue=False).then(fn = preprocess_and_invert,
|
| 375 |
inputs = [input_video,
|
| 376 |
frames,
|
| 377 |
latents,
|
|
@@ -391,9 +391,10 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 391 |
inverted_latents,
|
| 392 |
do_inversion,
|
| 393 |
batch_size,
|
| 394 |
-
n_frames
|
|
|
|
| 395 |
])
|
| 396 |
-
input_video.change(fn = calculate_fps, inputs=[input_video], outputs=[batch_size, n_frames], queue=False)
|
| 397 |
|
| 398 |
run_button.click(fn = edit_with_pnp,
|
| 399 |
inputs = [input_video,
|
|
|
|
| 125 |
print("total vid duration", total_vid_duration)
|
| 126 |
print("frames to process", frames_to_process)
|
| 127 |
print("batch size", batch_size)
|
| 128 |
+
return frames, batch_size, frames_to_process, None
|
| 129 |
|
| 130 |
def preprocess_and_invert(input_video,
|
| 131 |
frames,
|
|
|
|
| 192 |
inverted_latents = gr.State(value=total_inverted_latents)
|
| 193 |
do_inversion = False
|
| 194 |
|
| 195 |
+
return frames, latents, inverted_latents, do_inversion, preprocess_config['batch_size'], preprocess_config['n_frames'], None
|
| 196 |
|
| 197 |
|
| 198 |
def edit_with_pnp(input_video,
|
|
|
|
| 371 |
input_video.upload(
|
| 372 |
fn = reset_do_inversion,
|
| 373 |
outputs = [do_inversion],
|
| 374 |
+
queue = False).then(fn = calculate_fps, inputs=[input_video, batch_size], outputs=[frames, batch_size, n_frames], queue=False).then(fn = preprocess_and_invert,
|
| 375 |
inputs = [input_video,
|
| 376 |
frames,
|
| 377 |
latents,
|
|
|
|
| 391 |
inverted_latents,
|
| 392 |
do_inversion,
|
| 393 |
batch_size,
|
| 394 |
+
n_frames,
|
| 395 |
+
run_button
|
| 396 |
])
|
| 397 |
+
input_video.change(fn = calculate_fps, inputs=[input_video, batch_size], outputs=[batch_size, n_frames, run_button], queue=False)
|
| 398 |
|
| 399 |
run_button.click(fn = edit_with_pnp,
|
| 400 |
inputs = [input_video,
|