Update app.py
Browse files
app.py
CHANGED
|
@@ -57,8 +57,8 @@ opt_path = hf_hub_download(
|
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
-
os.makedirs("
|
| 61 |
-
os.environ['GRADIO_TEMP_DIR'] = '
|
| 62 |
|
| 63 |
def generate_md5(input_string):
|
| 64 |
# Encode the string and compute the MD5 hash
|
|
@@ -84,7 +84,7 @@ HEAD = ("""<div class="embed_hidden" style="text-align: center;">
|
|
| 84 |
<h1>MotionCLR: Motion Generation and Training-free Editing via Understanding Attention Mechanisms</h1>
|
| 85 |
<h3>
|
| 86 |
<a href="https://lhchen.top" target="_blank" rel="noopener noreferrer">Ling-Hao Chen</a><sup>1, 2</sup>,
|
| 87 |
-
<a href="https://shunlinlu.github.io" target="_blank" rel="noopener noreferrer">Wenxun Dai</a><sup>
|
| 88 |
<a href="https://shunlinlu.github.io" target="_blank" rel="noopener noreferrer">Xuan Ju</a><sup>3</sup>,
|
| 89 |
<a href="https://shunlinlu.github.io" target="_blank" rel="noopener noreferrer">Shunlin Lu</a><sup>4</sup>,
|
| 90 |
<a href="https://leizhang.org" target="_blank" rel="noopener noreferrer">Lei Zhang</a><sup>🤗 2</sup>
|
|
@@ -111,7 +111,7 @@ HEAD = ("""<div class="embed_hidden" style="text-align: center;">
|
|
| 111 |
|
| 112 |
|
| 113 |
edit_config = yaml_to_box('options/edit.yaml')
|
| 114 |
-
os.environ['GRADIO_TEMP_DIR'] = '
|
| 115 |
CSS = """
|
| 116 |
.retrieved_video {
|
| 117 |
position: relative;
|
|
@@ -145,7 +145,7 @@ def generate_video_from_text(text, opt, pipeline):
|
|
| 145 |
texts = [text]
|
| 146 |
motion_lens = [opt.motion_length * opt.fps for _ in range(opt.num_samples)]
|
| 147 |
|
| 148 |
-
save_dir = '
|
| 149 |
filename = generate_md5(str(time.time())) + ".mp4"
|
| 150 |
save_path = pjoin(save_dir, str(filename))
|
| 151 |
os.makedirs(save_dir, exist_ok=True)
|
|
@@ -227,7 +227,7 @@ def reweighting(text, idx, weight, opt, pipeline):
|
|
| 227 |
texts = [text, text]
|
| 228 |
motion_lens = [opt.motion_length * opt.fps for _ in range(opt.num_samples)]
|
| 229 |
|
| 230 |
-
save_dir = '
|
| 231 |
filenames = [generate_md5(str(time.time())) + ".mp4", generate_md5(str(time.time())) + ".mp4"]
|
| 232 |
save_paths = [pjoin(save_dir, str(filenames[0])), pjoin(save_dir, str(filenames[1]))]
|
| 233 |
os.makedirs(save_dir, exist_ok=True)
|
|
@@ -306,7 +306,7 @@ def generate_example_based_motion(text, chunk_size, example_based_steps_end, tem
|
|
| 306 |
texts = [text for _ in range(num_motion)]
|
| 307 |
motion_lens = [opt.motion_length * opt.fps for _ in range(opt.num_samples)]
|
| 308 |
|
| 309 |
-
save_dir = '
|
| 310 |
filenames = [generate_md5(str(time.time())) + ".mp4" for _ in range(num_motion)]
|
| 311 |
save_paths = [pjoin(save_dir, str(filenames[i])) for i in range(num_motion)]
|
| 312 |
os.makedirs(save_dir, exist_ok=True)
|
|
@@ -391,7 +391,7 @@ def transfer_style(text, style_text, style_transfer_steps_end, opt, pipeline):
|
|
| 391 |
texts = [style_text, text, text]
|
| 392 |
motion_lens = [opt.motion_length * opt.fps for _ in range(opt.num_samples)]
|
| 393 |
|
| 394 |
-
save_dir = '
|
| 395 |
filenames = [generate_md5(str(time.time())) + ".mp4", generate_md5(str(time.time())) + ".mp4", generate_md5(str(time.time())) + ".mp4"]
|
| 396 |
save_paths = [pjoin(save_dir, str(filenames[0])), pjoin(save_dir, str(filenames[1])), pjoin(save_dir, str(filenames[2]))]
|
| 397 |
os.makedirs(save_dir, exist_ok=True)
|
|
|
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
+
os.makedirs("temp", exist_ok=True)
|
| 61 |
+
os.environ['GRADIO_TEMP_DIR'] = 'temp'
|
| 62 |
|
| 63 |
def generate_md5(input_string):
|
| 64 |
# Encode the string and compute the MD5 hash
|
|
|
|
| 84 |
<h1>MotionCLR: Motion Generation and Training-free Editing via Understanding Attention Mechanisms</h1>
|
| 85 |
<h3>
|
| 86 |
<a href="https://lhchen.top" target="_blank" rel="noopener noreferrer">Ling-Hao Chen</a><sup>1, 2</sup>,
|
| 87 |
+
<a href="https://shunlinlu.github.io" target="_blank" rel="noopener noreferrer">Wenxun Dai</a><sup>1</sup>,
|
| 88 |
<a href="https://shunlinlu.github.io" target="_blank" rel="noopener noreferrer">Xuan Ju</a><sup>3</sup>,
|
| 89 |
<a href="https://shunlinlu.github.io" target="_blank" rel="noopener noreferrer">Shunlin Lu</a><sup>4</sup>,
|
| 90 |
<a href="https://leizhang.org" target="_blank" rel="noopener noreferrer">Lei Zhang</a><sup>🤗 2</sup>
|
|
|
|
| 111 |
|
| 112 |
|
| 113 |
edit_config = yaml_to_box('options/edit.yaml')
|
| 114 |
+
os.environ['GRADIO_TEMP_DIR'] = 'temp'
|
| 115 |
CSS = """
|
| 116 |
.retrieved_video {
|
| 117 |
position: relative;
|
|
|
|
| 145 |
texts = [text]
|
| 146 |
motion_lens = [opt.motion_length * opt.fps for _ in range(opt.num_samples)]
|
| 147 |
|
| 148 |
+
save_dir = 'temp/gen/'
|
| 149 |
filename = generate_md5(str(time.time())) + ".mp4"
|
| 150 |
save_path = pjoin(save_dir, str(filename))
|
| 151 |
os.makedirs(save_dir, exist_ok=True)
|
|
|
|
| 227 |
texts = [text, text]
|
| 228 |
motion_lens = [opt.motion_length * opt.fps for _ in range(opt.num_samples)]
|
| 229 |
|
| 230 |
+
save_dir = 'temp/gen/'
|
| 231 |
filenames = [generate_md5(str(time.time())) + ".mp4", generate_md5(str(time.time())) + ".mp4"]
|
| 232 |
save_paths = [pjoin(save_dir, str(filenames[0])), pjoin(save_dir, str(filenames[1]))]
|
| 233 |
os.makedirs(save_dir, exist_ok=True)
|
|
|
|
| 306 |
texts = [text for _ in range(num_motion)]
|
| 307 |
motion_lens = [opt.motion_length * opt.fps for _ in range(opt.num_samples)]
|
| 308 |
|
| 309 |
+
save_dir = 'temp/gen/'
|
| 310 |
filenames = [generate_md5(str(time.time())) + ".mp4" for _ in range(num_motion)]
|
| 311 |
save_paths = [pjoin(save_dir, str(filenames[i])) for i in range(num_motion)]
|
| 312 |
os.makedirs(save_dir, exist_ok=True)
|
|
|
|
| 391 |
texts = [style_text, text, text]
|
| 392 |
motion_lens = [opt.motion_length * opt.fps for _ in range(opt.num_samples)]
|
| 393 |
|
| 394 |
+
save_dir = 'temp/gen/'
|
| 395 |
filenames = [generate_md5(str(time.time())) + ".mp4", generate_md5(str(time.time())) + ".mp4", generate_md5(str(time.time())) + ".mp4"]
|
| 396 |
save_paths = [pjoin(save_dir, str(filenames[0])), pjoin(save_dir, str(filenames[1])), pjoin(save_dir, str(filenames[2]))]
|
| 397 |
os.makedirs(save_dir, exist_ok=True)
|