Spaces:
Sleeping
Sleeping
echo "Starting entrypoint script..." | |
# Attempt to modify permissions of /data to ensure it's writable by the user | |
# Note: This might not work if /data's permissions are restricted outside the container | |
#chown -R user:user /data | |
# Authenticate with Hugging Face | |
export HF_HOME=/home/user/data/hf_cache | |
echo "Using Hugging Face API token for authentication" | |
# Navigate to the directory where download_model.py is located | |
echo "Determining model path..." | |
cd /home/user/app/utils | |
echo "Current directory for model download: $(pwd)" | |
# Execute the download_model script | |
python download_model.py || { echo "Model download failed"; exit 1; } | |
# Read the model path from model_path.txt and export it | |
MODEL_PATH=$(cat /home/user/data/models/model_path.txt) | |
export MODEL_PATH | |
echo "@ Entrypoint - MODEL_PATH exported=${MODEL_PATH}" | |
# Navigate back to the app directory | |
cd /home/user/app | |
echo "Returning to app directory: $(pwd)" | |
# Execute the main command of the container | |
echo "Executing main command..." | |
exec "$@" | |