Chorus-Detection / .space /app-entrypoint.sh
dennisvdang's picture
Refactor code and remove unnecessary files
606184e
��#!/bin/bash
# Check if running in Hugging Face Space
if [ -n "$SPACE_ID" ]; then
echo "Running in Hugging Face Space: $SPACE_ID"
# Set up environment variables
export PYTHONPATH=$PYTHONPATH:/app:/home/user/app:.
export MODEL_REVISION="20e66eb3d0788373c3bdc5b28fa2f2587b0e475f3bbc47e8ab9ff0dbdbb2df32"
export MODEL_HF_REPO="dennisvdang/chorus-detection"
export HF_MODEL_FILENAME="chorus_detection_crnn.h5"
# Download model if needed
python -c "from download_model import ensure_model_exists; ensure_model_exists(revision='$MODEL_REVISION')" || \
echo "Failed to download model, but continuing..."
fi
# Run the Streamlit app
cd /home/user/app
streamlit run app.py --server.port=7860 --server.address=0.0.0.0