Spaces:
Sleeping
Sleeping
Download wait_for_space.sh from ocx2025/basicsearch: direct link, hf CLI and curl.
- Browser
- Download file 978 Bytes
-
https://huggingface.co/spaces/ocx2025/basicsearch/resolve/main/wait_for_space.sh
- Command line
-
hf download hf://spaces/ocx2025/basicsearch/wait_for_space.sh
-
curl -L -o wait_for_space.sh https://huggingface.co/spaces/ocx2025/basicsearch/resolve/main/wait_for_space.sh
978 Bytes
| 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" | |