fffiloni commited on
Commit
0027dc5
1 Parent(s): 30b0683

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -3,6 +3,7 @@ import subprocess
3
  import os
4
  from huggingface_hub import hf_hub_download
5
  import glob
 
6
 
7
  # Ensure 'checkpoint' directory exists
8
  os.makedirs("checkpoint", exist_ok=True)
@@ -27,6 +28,15 @@ def run_xportrait(
27
  num_mix,
28
  ddim_steps
29
  ):
 
 
 
 
 
 
 
 
 
30
  # Construct the command
31
  command = [
32
  "python3", "core/test_xportrait.py",
 
3
  import os
4
  from huggingface_hub import hf_hub_download
5
  import glob
6
+ from datetime import datetime
7
 
8
  # Ensure 'checkpoint' directory exists
9
  os.makedirs("checkpoint", exist_ok=True)
 
28
  num_mix,
29
  ddim_steps
30
  ):
31
+ # Check if the model weights are in place
32
+ if not os.path.exists(resume_dir):
33
+ return "Model weights not found in checkpoint directory. Please download them first."
34
+
35
+ # Create a unique output directory name based on current date and time
36
+ timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
37
+ output_dir = os.path.join(output_dir_base, f"output_{timestamp}")
38
+ os.makedirs(output_dir, exist_ok=True)
39
+
40
  # Construct the command
41
  command = [
42
  "python3", "core/test_xportrait.py",