File size: 1,238 Bytes
aca8ab4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #!/bin/bash
# Hugging Face Spaces startup script
# This runs after pip install to fix the mcp dependency conflict
echo "π§ Fixing MCP dependency conflict..."
pip install --force-reinstall --no-deps mcp==1.17.0
echo "β
MCP version fixed!"
pip show mcp | grep Version
# Check if required environment variables are set
echo ""
echo "π Checking environment variables..."
required_vars=("AZURE_OPENAI_ENDPOINT" "AZURE_OPENAI_API_KEY" "AZURE_OPENAI_DEPLOYMENT_NAME" "AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME")
missing_vars=()
for var in "${required_vars[@]}"; do
if [ -z "${!var}" ]; then
missing_vars+=("$var")
echo "β Missing: $var"
else
echo "β
Found: $var"
fi
done
if [ ${#missing_vars[@]} -ne 0 ]; then
echo ""
echo "β οΈ ERROR: Missing required environment variables!"
echo "Please set the following in HuggingFace Spaces Settings > Repository secrets:"
for var in "${missing_vars[@]}"; do
echo " - $var"
done
echo ""
echo "See .env.example for the complete list of required variables."
exit 1
fi
echo ""
echo "β
All required environment variables are set!"
echo ""
# Start the application
echo "π Starting application..."
python app.py
|