Spaces:
Sleeping
Sleeping
File size: 1,622 Bytes
8fc7d70 | 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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #!/usr/bin/env bash
set -e
echo "==========================================="
echo " API Debug Env - Full Validation Pipeline "
echo "==========================================="
echo -e "\n[1/4] Checking Python Syntax & Dependencies..."
pip install -r requirements.txt || echo "pip install failed"
echo -e "\n[2/4] Running 'openenv validate'..."
openenv validate
if [ $? -eq 0 ]; then
echo -e "β
openenv validate PASSED!"
else
echo -e "β openenv validate FAILED!"
exit 1
fi
echo -e "\n[3/4] Testing Docker Build locally..."
docker build -t api-debug-env-test .
if [ $? -eq 0 ]; then
echo -e "β
Docker build PASSED!"
else
echo -e "β Docker build FAILED!"
exit 1
fi
echo -e "\n[4/4] Testing inference.py natively..."
export HF_TOKEN="dummy_token_test"
export API_BASE_URL="https://router.huggingface.co/v1"
export MODEL_NAME="mistralai/Mistral-7B-Instruct-v0.3"
# Spin up the background server for inference.py to hit
echo "Starting local FastAPI server on port 7860..."
uvicorn server.app:app --port 7860 &
SERVER_PID=$!
# Give the server a few seconds to start up
sleep 3
echo "Running inference.py..."
python inference.py
INF_EXIT=$?
# Kill the background server
kill $SERVER_PID
if [ $INF_EXIT -eq 0 ]; then
echo -e "β
inference.py ran successfully without crashing!"
else
echo -e "β inference.py FAILED with status $INF_EXIT!"
exit 1
fi
echo -e "\n==========================================="
echo " π ALL VALIDATION CHECKS PASSED SUCCESSFULLY!"
echo " Everything is 100% ready for the Meta Hackathon."
echo "==========================================="
|