| import os |
| from huggingface_hub import hf_hub_download |
|
|
| |
| os.environ["HF_HOME"] = "/home/user/app/hf_cache" |
|
|
| |
| celeb_path = "/home/user/app/huggingface_models/CelebAMask-HQ" |
| face_parsing_path = os.path.join(celeb_path, "face_parsing") |
|
|
| print("[Info] PYTHONPATH:", os.environ.get("PYTHONPATH")) |
| print("[Info] CelebAMask-HQ path exists:", os.path.exists(celeb_path)) |
| print("[Info] face_parsing folder exists:", os.path.exists(face_parsing_path)) |
|
|
| |
| try: |
| model_path = hf_hub_download( |
| repo_id="public-data/CelebAMask-HQ-Face-Parsing", |
| filename="models/model.pth", |
| cache_dir="/home/user/app/hf_cache" |
| ) |
| print("[Success] Model downloaded to:", model_path) |
| |
| except Exception as e: |
| print("[Error] Failed to download model:", str(e)) |