Spaces:
Running
on
Zero
Running
on
Zero
Update gradio_tabs/vid_edit.py
Browse files- gradio_tabs/vid_edit.py +1 -31
gradio_tabs/vid_edit.py
CHANGED
|
@@ -8,17 +8,6 @@ import imageio
|
|
| 8 |
from einops import rearrange
|
| 9 |
import spaces
|
| 10 |
|
| 11 |
-
# extensions_dir = "./torch_extension/"
|
| 12 |
-
# os.environ["TORCH_EXTENSIONS_DIR"] = extensions_dir
|
| 13 |
-
|
| 14 |
-
# from networks.generator import Generator
|
| 15 |
-
|
| 16 |
-
# device = torch.device("cuda")
|
| 17 |
-
# ckpt_path = './models/lia-x.pt'
|
| 18 |
-
# gen = Generator(size=512, motion_dim=40, scale=2).to(device)
|
| 19 |
-
# gen.load_state_dict(torch.load(ckpt_path, weights_only=False))
|
| 20 |
-
# gen.eval()
|
| 21 |
-
|
| 22 |
output_dir = "./res_gradio"
|
| 23 |
os.makedirs(output_dir, exist_ok=True)
|
| 24 |
|
|
@@ -130,13 +119,6 @@ def vid_all_save(vid_d, vid_a, fps, output_path=output_dir + "/output_vid.mp4",
|
|
| 130 |
|
| 131 |
|
| 132 |
def vid_edit(gen, device):
|
| 133 |
-
|
| 134 |
-
# from networks.generator import Generator
|
| 135 |
-
|
| 136 |
-
# device = torch.device("cuda")
|
| 137 |
-
# gen = Generator(size=512, motion_dim=40, scale=2).to(device)
|
| 138 |
-
# gen.load_state_dict(torch.hub.load_state_dict_from_url(f"https://huggingface.co/YaohuiW/LIA-X/resolve/main/lia-x.pt"))
|
| 139 |
-
# gen.eval()
|
| 140 |
|
| 141 |
|
| 142 |
@torch.no_grad()
|
|
@@ -170,10 +152,6 @@ def vid_edit(gen, device):
|
|
| 170 |
|
| 171 |
def clear_media():
|
| 172 |
return None, None, None, *([0] * len(labels_k))
|
| 173 |
-
|
| 174 |
-
#image_output = gr.Image(label="Image", type='numpy', interactive=False, width=512)
|
| 175 |
-
#video_output = gr.Video(label="Video", width=512)
|
| 176 |
-
#video_all_output = gr.Video(label="Videos")
|
| 177 |
|
| 178 |
with gr.Tab("Video Editing"):
|
| 179 |
|
|
@@ -202,14 +180,6 @@ def vid_edit(gen, device):
|
|
| 202 |
visible=True,
|
| 203 |
)
|
| 204 |
|
| 205 |
-
# with gr.Row():
|
| 206 |
-
# with gr.Column(scale=1):
|
| 207 |
-
# with gr.Row(): # Buttons now within a single Row
|
| 208 |
-
# edit_btn = gr.Button("Edit")
|
| 209 |
-
# clear_btn = gr.Button("Clear")
|
| 210 |
-
# with gr.Row():
|
| 211 |
-
# animate_btn = gr.Button("Generate")
|
| 212 |
-
|
| 213 |
with gr.Column(scale=2):
|
| 214 |
|
| 215 |
with gr.Row():
|
|
@@ -300,7 +270,7 @@ def vid_edit(gen, device):
|
|
| 300 |
fn=edit_vid,
|
| 301 |
inputs=[video_input] + inputs_s,
|
| 302 |
outputs=[video_output, video_all_output],
|
| 303 |
-
cache_examples=
|
| 304 |
)
|
| 305 |
|
| 306 |
|
|
|
|
| 8 |
from einops import rearrange
|
| 9 |
import spaces
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
output_dir = "./res_gradio"
|
| 12 |
os.makedirs(output_dir, exist_ok=True)
|
| 13 |
|
|
|
|
| 119 |
|
| 120 |
|
| 121 |
def vid_edit(gen, device):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
|
| 124 |
@torch.no_grad()
|
|
|
|
| 152 |
|
| 153 |
def clear_media():
|
| 154 |
return None, None, None, *([0] * len(labels_k))
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
|
| 156 |
with gr.Tab("Video Editing"):
|
| 157 |
|
|
|
|
| 180 |
visible=True,
|
| 181 |
)
|
| 182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
with gr.Column(scale=2):
|
| 184 |
|
| 185 |
with gr.Row():
|
|
|
|
| 270 |
fn=edit_vid,
|
| 271 |
inputs=[video_input] + inputs_s,
|
| 272 |
outputs=[video_output, video_all_output],
|
| 273 |
+
cache_examples="lazy",
|
| 274 |
)
|
| 275 |
|
| 276 |
|