Update app.py
Browse files
app.py
CHANGED
|
@@ -25,7 +25,7 @@ ckptdir = './checkpoints/t2m/release'
|
|
| 25 |
os.makedirs(ckptdir, exist_ok=True)
|
| 26 |
|
| 27 |
|
| 28 |
-
os.environ['GRADIO_TEMP_DIR']="temp"
|
| 29 |
|
| 30 |
mean_path = hf_hub_download(
|
| 31 |
repo_id="EvanTHU/MotionCLR",
|
|
@@ -57,8 +57,8 @@ opt_path = hf_hub_download(
|
|
| 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
|
|
@@ -113,7 +113,7 @@ HEAD = ("""<div>
|
|
| 113 |
|
| 114 |
|
| 115 |
edit_config = yaml_to_box('options/edit.yaml')
|
| 116 |
-
os.environ['GRADIO_TEMP_DIR'] = 'temp'
|
| 117 |
CSS = """
|
| 118 |
.retrieved_video {
|
| 119 |
position: relative;
|
|
@@ -147,7 +147,7 @@ def generate_video_from_text(text, opt, pipeline):
|
|
| 147 |
texts = [text]
|
| 148 |
motion_lens = [opt.motion_length * opt.fps for _ in range(opt.num_samples)]
|
| 149 |
|
| 150 |
-
save_dir = 'temp/'
|
| 151 |
filename = generate_md5(str(time.time())) + ".mp4"
|
| 152 |
save_path = pjoin(save_dir, str(filename))
|
| 153 |
os.makedirs(save_dir, exist_ok=True)
|
|
@@ -231,7 +231,7 @@ def reweighting(text, idx, weight, opt, pipeline):
|
|
| 231 |
texts = [text, text]
|
| 232 |
motion_lens = [opt.motion_length * opt.fps for _ in range(opt.num_samples)]
|
| 233 |
|
| 234 |
-
save_dir = 'temp/'
|
| 235 |
filenames = [generate_md5(str(time.time())) + ".mp4", generate_md5(str(time.time())) + ".mp4"]
|
| 236 |
save_paths = [pjoin(save_dir, str(filenames[0])), pjoin(save_dir, str(filenames[1]))]
|
| 237 |
os.makedirs(save_dir, exist_ok=True)
|
|
@@ -310,7 +310,7 @@ def generate_example_based_motion(text, chunk_size, example_based_steps_end, tem
|
|
| 310 |
texts = [text for _ in range(num_motion)]
|
| 311 |
motion_lens = [opt.motion_length * opt.fps for _ in range(opt.num_samples)]
|
| 312 |
|
| 313 |
-
save_dir = 'temp/'
|
| 314 |
filenames = [generate_md5(str(time.time())) + ".mp4" for _ in range(num_motion)]
|
| 315 |
save_paths = [pjoin(save_dir, str(filenames[i])) for i in range(num_motion)]
|
| 316 |
os.makedirs(save_dir, exist_ok=True)
|
|
@@ -395,7 +395,7 @@ def transfer_style(text, style_text, style_transfer_steps_end, opt, pipeline):
|
|
| 395 |
texts = [style_text, text, text]
|
| 396 |
motion_lens = [opt.motion_length * opt.fps for _ in range(opt.num_samples)]
|
| 397 |
|
| 398 |
-
save_dir = 'temp/'
|
| 399 |
filenames = [generate_md5(str(time.time())) + ".mp4", generate_md5(str(time.time())) + ".mp4", generate_md5(str(time.time())) + ".mp4"]
|
| 400 |
save_paths = [pjoin(save_dir, str(filenames[0])), pjoin(save_dir, str(filenames[1])), pjoin(save_dir, str(filenames[2]))]
|
| 401 |
os.makedirs(save_dir, exist_ok=True)
|
|
|
|
| 25 |
os.makedirs(ckptdir, exist_ok=True)
|
| 26 |
|
| 27 |
|
| 28 |
+
os.environ['GRADIO_TEMP_DIR']="/home/user/app/temp"
|
| 29 |
|
| 30 |
mean_path = hf_hub_download(
|
| 31 |
repo_id="EvanTHU/MotionCLR",
|
|
|
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
+
os.makedirs("/home/user/app/temp", exist_ok=True)
|
| 61 |
+
os.environ['GRADIO_TEMP_DIR'] = '/home/user/app/temp'
|
| 62 |
|
| 63 |
def generate_md5(input_string):
|
| 64 |
# Encode the string and compute the MD5 hash
|
|
|
|
| 113 |
|
| 114 |
|
| 115 |
edit_config = yaml_to_box('options/edit.yaml')
|
| 116 |
+
os.environ['GRADIO_TEMP_DIR'] = '/home/user/app/temp'
|
| 117 |
CSS = """
|
| 118 |
.retrieved_video {
|
| 119 |
position: relative;
|
|
|
|
| 147 |
texts = [text]
|
| 148 |
motion_lens = [opt.motion_length * opt.fps for _ in range(opt.num_samples)]
|
| 149 |
|
| 150 |
+
save_dir = '/home/user/app/temp/'
|
| 151 |
filename = generate_md5(str(time.time())) + ".mp4"
|
| 152 |
save_path = pjoin(save_dir, str(filename))
|
| 153 |
os.makedirs(save_dir, exist_ok=True)
|
|
|
|
| 231 |
texts = [text, text]
|
| 232 |
motion_lens = [opt.motion_length * opt.fps for _ in range(opt.num_samples)]
|
| 233 |
|
| 234 |
+
save_dir = '/home/user/app/temp/'
|
| 235 |
filenames = [generate_md5(str(time.time())) + ".mp4", generate_md5(str(time.time())) + ".mp4"]
|
| 236 |
save_paths = [pjoin(save_dir, str(filenames[0])), pjoin(save_dir, str(filenames[1]))]
|
| 237 |
os.makedirs(save_dir, exist_ok=True)
|
|
|
|
| 310 |
texts = [text for _ in range(num_motion)]
|
| 311 |
motion_lens = [opt.motion_length * opt.fps for _ in range(opt.num_samples)]
|
| 312 |
|
| 313 |
+
save_dir = '/home/user/app/temp/'
|
| 314 |
filenames = [generate_md5(str(time.time())) + ".mp4" for _ in range(num_motion)]
|
| 315 |
save_paths = [pjoin(save_dir, str(filenames[i])) for i in range(num_motion)]
|
| 316 |
os.makedirs(save_dir, exist_ok=True)
|
|
|
|
| 395 |
texts = [style_text, text, text]
|
| 396 |
motion_lens = [opt.motion_length * opt.fps for _ in range(opt.num_samples)]
|
| 397 |
|
| 398 |
+
save_dir = '/home/user/app/temp/'
|
| 399 |
filenames = [generate_md5(str(time.time())) + ".mp4", generate_md5(str(time.time())) + ".mp4", generate_md5(str(time.time())) + ".mp4"]
|
| 400 |
save_paths = [pjoin(save_dir, str(filenames[0])), pjoin(save_dir, str(filenames[1])), pjoin(save_dir, str(filenames[2]))]
|
| 401 |
os.makedirs(save_dir, exist_ok=True)
|