supraptin commited on
Commit
6fb37f2
·
1 Parent(s): 4e26286

Fix: handle empty Silent-Face-Anti-Spoofing directory, use shallow clone

Browse files
Files changed (2) hide show
  1. Dockerfile +0 -1
  2. setup_models.py +6 -3
Dockerfile CHANGED
@@ -26,7 +26,6 @@ WORKDIR /home/user/app
26
  # Create directories with correct ownership for models
27
  RUN mkdir -p /home/user/app/models/auraface \
28
  /home/user/app/models/anti_spoof \
29
- /home/user/app/Silent-Face-Anti-Spoofing \
30
  /home/user/app/.cache \
31
  && chown -R user:user /home/user/app
32
 
 
26
  # Create directories with correct ownership for models
27
  RUN mkdir -p /home/user/app/models/auraface \
28
  /home/user/app/models/anti_spoof \
 
29
  /home/user/app/.cache \
30
  && chown -R user:user /home/user/app
31
 
setup_models.py CHANGED
@@ -54,12 +54,15 @@ def setup_silent_face_anti_spoofing():
54
  repo_dir = Path("Silent-Face-Anti-Spoofing")
55
  models_dir = Path("models/anti_spoof")
56
 
57
- # Clone repository if not exists
58
- if not repo_dir.exists():
59
  print("Cloning Silent-Face-Anti-Spoofing repository...")
 
 
 
60
  try:
61
  result = subprocess.run(
62
- ["git", "clone", "https://github.com/minivision-ai/Silent-Face-Anti-Spoofing.git"],
63
  capture_output=True,
64
  text=True
65
  )
 
54
  repo_dir = Path("Silent-Face-Anti-Spoofing")
55
  models_dir = Path("models/anti_spoof")
56
 
57
+ # Clone repository if not exists or is empty
58
+ if not repo_dir.exists() or not any(repo_dir.iterdir()):
59
  print("Cloning Silent-Face-Anti-Spoofing repository...")
60
+ # Remove empty directory if it exists
61
+ if repo_dir.exists():
62
+ shutil.rmtree(repo_dir)
63
  try:
64
  result = subprocess.run(
65
+ ["git", "clone", "--depth", "1", "https://github.com/minivision-ai/Silent-Face-Anti-Spoofing.git"],
66
  capture_output=True,
67
  text=True
68
  )