Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
025dc29
1
Parent(s):
b1af849
Update app.py
Browse files
app.py
CHANGED
|
@@ -160,7 +160,8 @@ def edit_with_pnp(input_video,
|
|
| 160 |
n_frames: int = 40,#needs to be the same as for preprocess
|
| 161 |
n_timesteps: int = 50,
|
| 162 |
gudiance_scale: float = 7.5,
|
| 163 |
-
inversion_prompt: str = ""#needs to be the same as for preprocess
|
|
|
|
| 164 |
):
|
| 165 |
config = {}
|
| 166 |
|
|
@@ -201,7 +202,7 @@ def edit_with_pnp(input_video,
|
|
| 201 |
editor = TokenFlow(config=config, frames=frames.value, inverted_latents=inverted_latents.value)
|
| 202 |
edited_frames = editor.edit_video()
|
| 203 |
|
| 204 |
-
save_video(edited_frames, 'tokenflow_PnP_fps_30.mp4', fps=
|
| 205 |
# path = export_to_video(edited_frames)
|
| 206 |
return 'tokenflow_PnP_fps_30.mp4', frames, latents, inverted_latents, do_inversion
|
| 207 |
|
|
@@ -268,11 +269,13 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 268 |
batch_size = gr.Slider(label='Batch size', minimum=1, maximum=10,
|
| 269 |
value=8, step=1, interactive=True)
|
| 270 |
n_frames = gr.Slider(label='Num frames', minimum=20, maximum=200,
|
| 271 |
-
value=
|
| 272 |
n_timesteps = gr.Slider(label='Diffusion steps', minimum=25, maximum=100,
|
| 273 |
value=50, step=1, interactive=True)
|
|
|
|
|
|
|
| 274 |
|
| 275 |
-
with gr.TabItem('Plug-and-
|
| 276 |
with gr.Column(min_width=100):
|
| 277 |
pnp_attn_t = gr.Slider(label='pnp attention threshold', minimum=0, maximum=1,
|
| 278 |
value=0.5, step=0.5, interactive=True)
|
|
@@ -324,7 +327,8 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 324 |
n_frames,
|
| 325 |
n_timesteps,
|
| 326 |
gudiance_scale,
|
| 327 |
-
inversion_prompt
|
|
|
|
| 328 |
outputs = [output_video, frames, latents, inverted_latents, do_inversion]
|
| 329 |
)
|
| 330 |
|
|
|
|
| 160 |
n_frames: int = 40,#needs to be the same as for preprocess
|
| 161 |
n_timesteps: int = 50,
|
| 162 |
gudiance_scale: float = 7.5,
|
| 163 |
+
inversion_prompt: str = "", #needs to be the same as for preprocess
|
| 164 |
+
n_fps: int = 10
|
| 165 |
):
|
| 166 |
config = {}
|
| 167 |
|
|
|
|
| 202 |
editor = TokenFlow(config=config, frames=frames.value, inverted_latents=inverted_latents.value)
|
| 203 |
edited_frames = editor.edit_video()
|
| 204 |
|
| 205 |
+
save_video(edited_frames, 'tokenflow_PnP_fps_30.mp4', fps=n_fps)
|
| 206 |
# path = export_to_video(edited_frames)
|
| 207 |
return 'tokenflow_PnP_fps_30.mp4', frames, latents, inverted_latents, do_inversion
|
| 208 |
|
|
|
|
| 269 |
batch_size = gr.Slider(label='Batch size', minimum=1, maximum=10,
|
| 270 |
value=8, step=1, interactive=True)
|
| 271 |
n_frames = gr.Slider(label='Num frames', minimum=20, maximum=200,
|
| 272 |
+
value=30, step=1, interactive=True)
|
| 273 |
n_timesteps = gr.Slider(label='Diffusion steps', minimum=25, maximum=100,
|
| 274 |
value=50, step=1, interactive=True)
|
| 275 |
+
n_fps = gr.Slider(label='Frames per second', minimum=1, maximum=60,
|
| 276 |
+
value=10, step=1, interactive=True)
|
| 277 |
|
| 278 |
+
with gr.TabItem('Plug-and-Play Parameters'):
|
| 279 |
with gr.Column(min_width=100):
|
| 280 |
pnp_attn_t = gr.Slider(label='pnp attention threshold', minimum=0, maximum=1,
|
| 281 |
value=0.5, step=0.5, interactive=True)
|
|
|
|
| 327 |
n_frames,
|
| 328 |
n_timesteps,
|
| 329 |
gudiance_scale,
|
| 330 |
+
inversion_prompt,
|
| 331 |
+
n_fps ],
|
| 332 |
outputs = [output_video, frames, latents, inverted_latents, do_inversion]
|
| 333 |
)
|
| 334 |
|