Spaces:
Running
on
Zero
Running
on
Zero
Commit
Β·
3fc9d60
1
Parent(s):
460fe75
update
Browse files- app.py +23 -25
- test/videos/0-NNvgaTcVzAG0-r.mp4 β examples/example_01.mp4 +0 -0
- test/videos/tUfDESZsQFhdDW9S.mp4 β examples/example_02.mp4 +0 -0
- test/videos/part-2-3.mp4 β examples/example_03.mp4 +0 -0
- test/videos/p7.mp4 β examples/example_04.mp4 +0 -0
- test/videos/UST-fn-RvhJwMR5S.mp4 β examples/example_05.mp4 +0 -0
- test/trajs/loop1.txt +0 -3
- test/trajs/loop2.txt +0 -3
app.py
CHANGED
|
@@ -11,33 +11,30 @@ from datetime import datetime
|
|
| 11 |
import argparse
|
| 12 |
from huggingface_hub import snapshot_download
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
traj_examples = [
|
| 17 |
['20; -30; 0.3; 0; 0'],
|
| 18 |
['0; 0; -0.3; -2; 2'],
|
| 19 |
]
|
| 20 |
|
| 21 |
-
# inputs=[i2v_input_video, i2v_stride, i2v_center_scale, i2v_pose, i2v_steps, i2v_seed],
|
| 22 |
-
|
| 23 |
-
img_examples = [
|
| 24 |
-
['test/videos/0-NNvgaTcVzAG0-r.mp4',2,1,'0; -30; 0.5; -2; 0',50,43],
|
| 25 |
-
['test/videos/tUfDESZsQFhdDW9S.mp4',2,1,'0; 30; -0.4; 2; 0',50,43],
|
| 26 |
-
['test/videos/part-2-3.mp4',2,1,'20; 40; 0.5; 2; 0',50,43],
|
| 27 |
-
['test/videos/p7.mp4',2,1,'0; -50; 0.3; 0; 0',50,43],
|
| 28 |
-
['test/videos/UST-fn-RvhJwMR5S.mp4',2,1,'0; -35; 0.4; 0; 0',50,43],
|
| 29 |
-
]
|
| 30 |
-
|
| 31 |
max_seed = 2 ** 31
|
| 32 |
|
| 33 |
os.makedirs('./checkpoints/',exist_ok=True)
|
| 34 |
-
def download_model():
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
download_model() #fixme
|
| 41 |
|
| 42 |
parser = get_parser() # infer_config.py
|
| 43 |
opts = parser.parse_args() # default device: 'cuda:0'
|
|
@@ -48,8 +45,6 @@ os.makedirs(opts.save_dir,exist_ok=True)
|
|
| 48 |
test_tensor = torch.Tensor([0]).cuda()
|
| 49 |
opts.device = str(test_tensor.device)
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
CAMERA_MOTION_MODE = ["Basic Camera Trajectory", "Custom Camera Trajectory"]
|
| 54 |
|
| 55 |
def show_traj(mode):
|
|
@@ -97,7 +92,7 @@ def trajcrafter_demo(opts):
|
|
| 97 |
}
|
| 98 |
"""
|
| 99 |
image2video = TrajCrafter(opts,gradio=True)
|
| 100 |
-
image2video.run_gradio = spaces.GPU(image2video.run_gradio, duration=
|
| 101 |
with gr.Blocks(analytics_enabled=False, css=css) as trajcrafter_iface:
|
| 102 |
gr.Markdown("""
|
| 103 |
<div align='center'>
|
|
@@ -128,7 +123,7 @@ def trajcrafter_demo(opts):
|
|
| 128 |
i2v_center_scale = gr.Slider(minimum=0.1, maximum=2, step=0.1, elem_id="i2v_center_scale",
|
| 129 |
label="center_scale", value=1)
|
| 130 |
i2v_steps = gr.Slider(minimum=1, maximum=50, step=1, elem_id="i2v_steps", label="Sampling steps",
|
| 131 |
-
value=
|
| 132 |
i2v_seed = gr.Slider(label='Random seed', minimum=0, maximum=max_seed, step=1, value=43)
|
| 133 |
with gr.Row():
|
| 134 |
pan_left = gr.Button(value="Pan Left")
|
|
@@ -283,11 +278,14 @@ def trajcrafter_demo(opts):
|
|
| 283 |
)
|
| 284 |
|
| 285 |
|
| 286 |
-
gr.Examples(examples=
|
| 287 |
# inputs=[i2v_input_video,i2v_stride],
|
| 288 |
inputs=[i2v_input_video, i2v_stride, i2v_center_scale, i2v_pose, i2v_steps, i2v_seed],
|
| 289 |
-
|
| 290 |
-
|
|
|
|
|
|
|
|
|
|
| 291 |
return trajcrafter_iface
|
| 292 |
|
| 293 |
|
|
|
|
| 11 |
import argparse
|
| 12 |
from huggingface_hub import snapshot_download
|
| 13 |
|
| 14 |
+
|
| 15 |
+
examples = [
|
| 16 |
+
['examples/example_01.mp4',2,1,'0; -30; 0.5; -2; 0',30,43],
|
| 17 |
+
['examples/example_02.mp4',2,1,'0; 30; -0.4; 2; 0',30,43],
|
| 18 |
+
['examples/example_03.mp4',2,1,'20; 40; 0.5; 2; 0',30,43],
|
| 19 |
+
['examples/example_04.mp4',2,1,'0; -50; 0.3; 0; 0',30,43],
|
| 20 |
+
['examples/example_05.mp4',2,1,'0; -35; 0.4; 0; 0',30,43],
|
| 21 |
+
]
|
| 22 |
|
| 23 |
traj_examples = [
|
| 24 |
['20; -30; 0.3; 0; 0'],
|
| 25 |
['0; 0; -0.3; -2; 2'],
|
| 26 |
]
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
max_seed = 2 ** 31
|
| 29 |
|
| 30 |
os.makedirs('./checkpoints/',exist_ok=True)
|
| 31 |
+
# def download_model():
|
| 32 |
+
# snapshot_download(repo_id="TrajectoryCrafter/TrajectoryCrafter", local_dir="checkpoints/TrajectoryCrafter", local_dir_use_symlinks=False)
|
| 33 |
+
# snapshot_download(repo_id="tencent/DepthCrafter", local_dir="checkpoints/DepthCrafter", local_dir_use_symlinks=False)
|
| 34 |
+
# snapshot_download(repo_id="stabilityai/stable-video-diffusion-img2vid", local_dir="checkpoints/stable-video-diffusion-img2vid", local_dir_use_symlinks=False)
|
| 35 |
+
# snapshot_download(repo_id="alibaba-pai/CogVideoX-Fun-V1.1-5b-InP", local_dir="checkpoints/CogVideoX-Fun-V1.1-5b-InP", local_dir_use_symlinks=False)
|
| 36 |
+
# snapshot_download(repo_id="Salesforce/blip2-opt-2.7b", local_dir="checkpoints/blip2-opt-2.7b", local_dir_use_symlinks=False)
|
| 37 |
+
# download_model() #fixme
|
| 38 |
|
| 39 |
parser = get_parser() # infer_config.py
|
| 40 |
opts = parser.parse_args() # default device: 'cuda:0'
|
|
|
|
| 45 |
test_tensor = torch.Tensor([0]).cuda()
|
| 46 |
opts.device = str(test_tensor.device)
|
| 47 |
|
|
|
|
|
|
|
| 48 |
CAMERA_MOTION_MODE = ["Basic Camera Trajectory", "Custom Camera Trajectory"]
|
| 49 |
|
| 50 |
def show_traj(mode):
|
|
|
|
| 92 |
}
|
| 93 |
"""
|
| 94 |
image2video = TrajCrafter(opts,gradio=True)
|
| 95 |
+
image2video.run_gradio = spaces.GPU(image2video.run_gradio, duration=290) # fixme
|
| 96 |
with gr.Blocks(analytics_enabled=False, css=css) as trajcrafter_iface:
|
| 97 |
gr.Markdown("""
|
| 98 |
<div align='center'>
|
|
|
|
| 123 |
i2v_center_scale = gr.Slider(minimum=0.1, maximum=2, step=0.1, elem_id="i2v_center_scale",
|
| 124 |
label="center_scale", value=1)
|
| 125 |
i2v_steps = gr.Slider(minimum=1, maximum=50, step=1, elem_id="i2v_steps", label="Sampling steps",
|
| 126 |
+
value=30)
|
| 127 |
i2v_seed = gr.Slider(label='Random seed', minimum=0, maximum=max_seed, step=1, value=43)
|
| 128 |
with gr.Row():
|
| 129 |
pan_left = gr.Button(value="Pan Left")
|
|
|
|
| 278 |
)
|
| 279 |
|
| 280 |
|
| 281 |
+
gr.Examples(examples=examples,
|
| 282 |
# inputs=[i2v_input_video,i2v_stride],
|
| 283 |
inputs=[i2v_input_video, i2v_stride, i2v_center_scale, i2v_pose, i2v_steps, i2v_seed],
|
| 284 |
+
outputs=[i2v_output_video],
|
| 285 |
+
fn = image2video.run_gradio,
|
| 286 |
+
cache_examples="lazy",
|
| 287 |
+
)
|
| 288 |
+
|
| 289 |
return trajcrafter_iface
|
| 290 |
|
| 291 |
|
test/videos/0-NNvgaTcVzAG0-r.mp4 β examples/example_01.mp4
RENAMED
|
File without changes
|
test/videos/tUfDESZsQFhdDW9S.mp4 β examples/example_02.mp4
RENAMED
|
File without changes
|
test/videos/part-2-3.mp4 β examples/example_03.mp4
RENAMED
|
File without changes
|
test/videos/p7.mp4 β examples/example_04.mp4
RENAMED
|
File without changes
|
test/videos/UST-fn-RvhJwMR5S.mp4 β examples/example_05.mp4
RENAMED
|
File without changes
|
test/trajs/loop1.txt
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
0 2 10 15 12 6 0 -2 -5 -12 -8 -3 0
|
| 2 |
-
0 -3 -10 -20 -30 -25 -17 -10 0
|
| 3 |
-
0 0.02 0.09 0.16 0.25 0.2 0.09 0
|
|
|
|
|
|
|
|
|
|
|
|
test/trajs/loop2.txt
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
0 2 10 15 12 6 0 -2 -5 -12 -8 -3 0
|
| 2 |
-
0 3 10 20 30 25 17 10 0
|
| 3 |
-
0 0.02 0.09 0.16 0.25 0.28 0.19 0.09 0
|
|
|
|
|
|
|
|
|
|
|
|