test / app.py
danicor's picture
Update app.py
f2d2548 verified
raw
history blame
860 Bytes
import os
from huggingface_hub import hf_hub_download
# تنظیم مسیرهای کش
os.environ["HF_HOME"] = "/home/user/app/hf_cache"
# مسیر CelebAMask-HQ
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))
# دانلود مدل از Hugging Face
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))