PaperShow / .huggingface.yml
ZaynZhu
Rebuild PaperShow in Docker mode
ff60855
# ============================================
# Hugging Face Space build configuration
# Project: PaperShow
# ============================================
build:
python_version: "3.10"
env:
HF_HUB_ENABLE_HF_TRANSFER: "1"
commands:
# ⚙️ Step 0: 安装系统依赖(OpenCV / Matplotlib / PDF支持)
- echo "===== [STEP 0] Installing system dependencies ====="
- apt-get update && apt-get install -y libgl1 libsm6 libxext6 libxrender-dev && rm -rf /var/lib/apt/lists/*
# ⚙️ Step 1: 升级 pip 基础环境
- echo "===== [STEP 1] Upgrading pip / setuptools / wheel ====="
- pip install --upgrade pip setuptools wheel
- pip config set global.timeout 180
- pip config set global.index-url https://pypi.org/simple
# 🚀 Step 2: 安装核心依赖
- echo "===== [STEP 2] Installing core requirements ====="
- if [ -f requirements_core.txt ]; then \
echo "Found requirements_core.txt ✅"; \
pip install --no-cache-dir --prefer-binary -r requirements_core.txt; \
else \
echo "⚠️ requirements_core.txt not found!"; \
fi
# 💡 Step 3: 安装额外依赖(失败不阻塞)
- echo "===== [STEP 3] Installing extra requirements (non-blocking) ====="
- if [ -f requirements_extra.txt ]; then \
pip install --no-cache-dir --prefer-binary -r requirements_extra.txt || true; \
else \
echo "⚠️ requirements_extra.txt not found, skipping."; \
fi
# 🔍 Step 4: 显示安装结果
- echo "===== [STEP 4] Installed Python packages ====="
- pip list | head -n 50
# 🧠 Step 5: 验证关键依赖导入(明确打印)
- echo "===== [STEP 5] Verifying critical imports ====="
- python - <<'PYCODE'
import sys
print("Python version:", sys.version)
try:
import torch, transformers
print("✅ torch OK (version)", torch.__version__)
print("✅ transformers OK (version)", transformers.__version__)
except Exception as e:
print("❌ Dependency import failed:", e)
sys.exit(1)
PYCODE
# 🚀 Step 6: 启动主应用
- echo "===== [STEP 6] Launching app.py ====="
- python app.py