weijielyu commited on
Commit
343399b
·
1 Parent(s): 6132ce7
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -11,6 +11,16 @@ FaceLift: Single Image 3D Face Reconstruction
11
  Generates 3D head models from single images using multi-view diffusion and GS-LRM.
12
  """
13
 
 
 
 
 
 
 
 
 
 
 
14
  import json
15
  from pathlib import Path
16
  from datetime import datetime
@@ -31,7 +41,6 @@ import spaces
31
  # Install diff-gaussian-rasterization at runtime (requires GPU)
32
  import subprocess
33
  import sys
34
- import os
35
 
36
  # Outputs directory for generated files
37
  OUTPUTS_DIR = Path.cwd() / "outputs"
@@ -100,14 +109,6 @@ def download_weights_from_hf() -> Path:
100
  print(f"Downloading model weights from HuggingFace: {HF_REPO_ID}")
101
  print("This may take a few minutes on first run...")
102
 
103
- # Disable fast transfer if hf_transfer is not installed
104
- if os.environ.get("HF_HUB_ENABLE_HF_TRANSFER") == "1":
105
- try:
106
- import hf_transfer
107
- except ImportError:
108
- print("hf_transfer not available, disabling fast download")
109
- os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "0"
110
-
111
  # Download to local directory
112
  snapshot_download(
113
  repo_id=HF_REPO_ID,
 
11
  Generates 3D head models from single images using multi-view diffusion and GS-LRM.
12
  """
13
 
14
+ # Disable HF fast transfer if hf_transfer is not installed
15
+ # This MUST be done before importing huggingface_hub
16
+ import os
17
+ if os.environ.get("HF_HUB_ENABLE_HF_TRANSFER") == "1":
18
+ try:
19
+ import hf_transfer
20
+ except ImportError:
21
+ print("⚠️ hf_transfer not available, disabling fast download")
22
+ os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "0"
23
+
24
  import json
25
  from pathlib import Path
26
  from datetime import datetime
 
41
  # Install diff-gaussian-rasterization at runtime (requires GPU)
42
  import subprocess
43
  import sys
 
44
 
45
  # Outputs directory for generated files
46
  OUTPUTS_DIR = Path.cwd() / "outputs"
 
109
  print(f"Downloading model weights from HuggingFace: {HF_REPO_ID}")
110
  print("This may take a few minutes on first run...")
111
 
 
 
 
 
 
 
 
 
112
  # Download to local directory
113
  snapshot_download(
114
  repo_id=HF_REPO_ID,