AkashKumarave commited on
Commit
b4fbfab
·
verified ·
1 Parent(s): 68c6e14

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -14,7 +14,7 @@ os.environ["HF_HUB_OFFLINE"] = "1"
14
  device = "cpu"
15
  dtype = torch.float32
16
 
17
- # Load face encoder (InsightFace will download buffalo_l if needed)
18
  try:
19
  face_app = FaceAnalysis(providers=["CPUExecutionProvider"])
20
  face_app.prepare(ctx_id=0, det_size=(480, 480))
@@ -23,9 +23,13 @@ except Exception as e:
23
  raise RuntimeError(f"Failed to load InsightFace model: {e}. Ensure network access for initial download.")
24
 
25
  # Define paths for preloaded weights
26
- model_path = "./unet/" # Adjusted for preloaded Kolors weights
27
  ip_adapter_path = "./"
28
 
 
 
 
 
29
  # Check if weights exist
30
  kolors_weights = model_path + "diffusion_pytorch_model.safetensors"
31
  if not os.path.exists(kolors_weights):
 
14
  device = "cpu"
15
  dtype = torch.float32
16
 
17
+ # Load face encoder (InsightFace handles its own download)
18
  try:
19
  face_app = FaceAnalysis(providers=["CPUExecutionProvider"])
20
  face_app.prepare(ctx_id=0, det_size=(480, 480))
 
23
  raise RuntimeError(f"Failed to load InsightFace model: {e}. Ensure network access for initial download.")
24
 
25
  # Define paths for preloaded weights
26
+ model_path = "./unet/" # Preloaded Kolors weights should be at ./unet/
27
  ip_adapter_path = "./"
28
 
29
+ # Debug: List files in the root directory to confirm preloading
30
+ print("Files in root directory:", os.listdir("."))
31
+ print("Files in ./unet/ directory:", os.listdir("./unet") if os.path.exists("./unet") else "No ./unet/ directory")
32
+
33
  # Check if weights exist
34
  kolors_weights = model_path + "diffusion_pytorch_model.safetensors"
35
  if not os.path.exists(kolors_weights):