Spaces:
Sleeping
Sleeping
File size: 978 Bytes
8027f40 | 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 | #!/bin/bash
echo "⏳ Waiting for Space to restart and load YOUTUBE_API_KEY..."
echo ""
for i in {1..30}; do
echo -n "Attempt $i/30: "
# Check if space is responding
STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://ocx2025-basicsearch.hf.space/health 2>/dev/null)
if [ "$STATUS" = "200" ]; then
echo "✅ Space is UP!"
echo ""
echo "Testing YouTube API..."
curl -X POST https://ocx2025-basicsearch.hf.space/search \
-H "Content-Type: application/json" \
-d '{"query": "Python programming", "max_results": 1}' \
2>/dev/null | python3 -m json.tool
exit 0
elif [ "$STATUS" = "404" ]; then
echo "⚠️ 404 (Space might be private or still building)"
else
echo "⏳ Building... (Status: $STATUS)"
fi
sleep 6
done
echo ""
echo "❌ Timeout waiting for Space. Please check manually:"
echo "https://huggingface.co/spaces/ocx2025/basicsearch"
|