zejunyang commited on
Commit
0f77f4f
1 Parent(s): 6d3218f

fix path conflict

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -112,7 +112,9 @@ def audio2video(input_audio, ref_img, headpose_video=None, size=512, steps=25, l
112
  time_str = datetime.now().strftime("%H%M")
113
  save_dir_name = f"{time_str}--seed_{seed}-{size}x{size}"
114
 
115
- save_dir = Path(f"output/{date_str}/{save_dir_name}")
 
 
116
  save_dir.mkdir(exist_ok=True, parents=True)
117
 
118
  ref_image_np = cv2.cvtColor(ref_img, cv2.COLOR_RGB2BGR)
@@ -220,7 +222,9 @@ def video2video(ref_img, source_video, size=512, steps=25, length=60, seed=42):
220
  time_str = datetime.now().strftime("%H%M")
221
  save_dir_name = f"{time_str}--seed_{seed}-{size}x{size}"
222
 
223
- save_dir = Path(f"output/{date_str}/{save_dir_name}")
 
 
224
  save_dir.mkdir(exist_ok=True, parents=True)
225
 
226
  ref_image_np = cv2.cvtColor(ref_img, cv2.COLOR_RGB2BGR)
 
112
  time_str = datetime.now().strftime("%H%M")
113
  save_dir_name = f"{time_str}--seed_{seed}-{size}x{size}"
114
 
115
+ save_dir = Path(f"a2v_output/{date_str}/{save_dir_name}")
116
+ while os.path.exists(save_dir):
117
+ save_dir = Path(f"a2v_output/{date_str}/{save_dir_name}_{np.random.randint(10000):04d}")
118
  save_dir.mkdir(exist_ok=True, parents=True)
119
 
120
  ref_image_np = cv2.cvtColor(ref_img, cv2.COLOR_RGB2BGR)
 
222
  time_str = datetime.now().strftime("%H%M")
223
  save_dir_name = f"{time_str}--seed_{seed}-{size}x{size}"
224
 
225
+ save_dir = Path(f"v2v_output/{date_str}/{save_dir_name}")
226
+ while os.path.exists(save_dir):
227
+ save_dir = Path(f"v2v_output/{date_str}/{save_dir_name}_{np.random.randint(10000):04d}")
228
  save_dir.mkdir(exist_ok=True, parents=True)
229
 
230
  ref_image_np = cv2.cvtColor(ref_img, cv2.COLOR_RGB2BGR)