abyXsmart's picture
Upload 8 files
906a253 verified
Raw History Blame
1.18 kB
#!/usr/bin/env bash
# Hugging Face Spaces entrypoint
# This script starts the MEXC SMC Scanner as a containerized Space service.
set -euo pipefail
# Detect if running inside a container and auto-set PORT
if [[ -n "${HF_SPACE:-}" ]]; then
echo "[HF Space] Running in Hugging Face Space"
export PORT="${PORT:-7860}"
fi
# Guard: Telegram credentials are required
if [[ -z "${TELEGRAM_BOT_TOKEN:-}" || -z "${TELEGRAM_CHAT_ID:-}" ]]; then
echo "=============================================="
echo " SETUP REQUIRED"
echo "=============================================="
echo "Add these secrets in your Hugging Face Space settings:"
echo " - TELEGRAM_BOT_TOKEN"
echo " - TELEGRAM_CHAT_ID"
echo ""
echo "Restart the Space after adding them."
echo "=============================================="
# Don't exit — keep the server running so the UI is visible
# The scanner will log warnings on every cycle until creds are set
fi
# Upgrade pip in background so first request is fast
python -m pip install --upgrade pip -q &
cd /app
python preflight_check.py || true
exec uvicorn app:app --host 0.0.0.0 --port "${PORT:-7860}"