Spaces:
Paused
Paused
prince1604 commited on
Commit ·
c3a843f
1
Parent(s): 7db0953
Update README and add HF deployment verification
Browse filesFiles changed (3)
- HF_DEPLOYMENT_STATUS.mdAdded+223
- README.md+62-9
- verify_hf_deployment.pyAdded+111
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223# 🚀 HUGGING FACE DEPLOYMENT - COMPLETE GUIDE
## ✅ Code Successfully Pushed to GitHub**Commit**: `37260b4 - Deploy: Add query param support + clean requirements for HF`**Status**: Pushed to `master` branch
---
## 🔄 STEP 1: Trigger Hugging Face Rebuild
### Option A: Auto-Sync (If configured)Your HF Space should automatically detect the GitHub push and rebuild in **1-2 minutes**.
**Monitor here**: https://huggingface.co/spaces/ubuntu593/alt-scraper-api
### Option B: Manual TriggerIf auto-sync isn't working:
1. Go to: https://huggingface.co/spaces/ubuntu593/alt-scraper-api/settings2. Scroll to **"Sleeping Behavior"**3. Click **"Factory Reboot"** or **"Restart Space"**4. Wait 2-3 minutes for rebuild
---
## ⏰ STEP 2: Wait for Build (2-3 minutes)
Watch the build logs at:https://huggingface.co/spaces/ubuntu593/alt-scraper-api/logs
**Look for these success messages:**```Installing dependencies...✓ fastapi installed✓ playwright-stealth installed✓ All dependencies installedStarting uvicorn...Application startup complete```
---
## ✅ STEP 3: Verify Deployment
### Test 1: Health CheckOpen in browser or Postman:```https://ubuntu593-alt-scraper-api.hf.space/health```
**Expected**: `{"status": "alive"}`
---
### Test 2: System Status```https://ubuntu593-alt-scraper-api.hf.space/api/status?domain=https://wpengine.com```
**Expected**: JSON with region, latency, status
---
### Test 3: Start Scan (Query Params) - YOUR ORIGINAL REQUEST ✅
**Postman Configuration:**- **Method**: `POST`- **URL**: `https://ubuntu593-alt-scraper-api.hf.space/api/scanstart`- **Params Tab**: - `domain` = `https://wpengine.com` - `limit` = `26`
**Full URL:**```https://ubuntu593-alt-scraper-api.hf.space/api/scanstart?domain=https://wpengine.com&limit=26```
**Expected Response:**```json{ "job_id": "abc-123-def-456"}```
---
### Test 4: Start Scan (JSON Body Alternative)
**Postman Configuration:**- **Method**: `POST`- **URL**: `https://ubuntu593-alt-scraper-api.hf.space/api/scanstart`- **Body**: raw → JSON```json{ "domain": "https://wpengine.com", "limit": 26}```
**Expected Response:**```json{ "job_id": "xyz-789-ghi-012"}```
---
### Test 5: Check Progress
Use the `job_id` from Test 3 or 4:```https://ubuntu593-alt-scraper-api.hf.space/api/progress?job_id=YOUR_JOB_ID```
**Expected Response:**```json{ "status": "running", "percent": 45, "pages_scanned": 12, "images_found": 87, "message": "Scanning: https://wpengine.com/about", "elapsed_seconds": 10, "eta_seconds": 12, "error": null}```
---
### Test 6: Get Final Result
When status is "done":```https://ubuntu593-alt-scraper-api.hf.space/api/result?job_id=YOUR_JOB_ID```
**Expected Response:**```json{ "summary": { "total_pages_scanned": 26, "total_images_found": 150, ... }, "details": [...]}```
---
## 🔍 TROUBLESHOOTING
### If You Still Get 404:
1. **Check Build Status**: - Go to https://huggingface.co/spaces/ubuntu593/alt-scraper-api - Look for "Building..." or "Running" badge - If "Stopped", click "Restart Space"
2. **Check Build Logs**: - https://huggingface.co/spaces/ubuntu593/alt-scraper-api/logs - Look for errors in dependency installation
3. **Verify Git Sync**: - HF Space Settings → Repository - Ensure it's linked to: `https://github.com/prince1604/Alt-scraper-api` - Check "Auto-update from GitHub" is enabled
4. **Force Rebuild**: - Settings → Factory Reboot - Wait 3-5 minutes
---
## 📊 DEPLOYMENT TIMELINE
| Time | Action | Status ||------|--------|--------|| T+0min | Code pushed to GitHub | ✅ COMPLETE || T+1min | HF detects changes | ⏳ WAITING || T+2min | Build starts | ⏳ IN PROGRESS || T+5min | Build completes | ⏳ PENDING || T+6min | **API READY TO TEST** | 🎯 READY |
---
## ✅ SUCCESS CRITERIA
Your deployment is successful when:
- [ ] Health endpoint returns `{"status": "alive"}`- [ ] Status endpoint returns region info- [ ] Scanstart with query params (`?domain=...&limit=...`) returns job_id- [ ] Scanstart with JSON body also works- [ ] Progress tracking shows real-time updates- [ ] Result endpoint returns full scan report
---
## 🎯 YOUR EXACT WORKING URL (After Deployment)
```POST https://ubuntu593-alt-scraper-api.hf.space/api/scanstart?domain=https://wpengine.com&limit=26```
**This URL will work in Postman with Params tab exactly as you configured!**
---
## ⚡ NEXT STEPS
1. Wait **2-3 minutes** for HF rebuild2. Test health endpoint first3. Then test your scanstart request4. If it works → You're done! ✅5. If still 404 → Check troubleshooting section above
---
**Status**: Code deployed. Waiting for HF build completion...**ETA**: 2-3 minutes from now (17:23 IST)123454 unmodified lines101112131415161718192021222324---title: Alt Scraper Apiemoji: 🕷️colorFrom: purplecolorTo: blue4 unmodified lines# Alt Scraper APIA robust SEO scraping API built with Python, Flask, and Playwright. Hostable for free on Hugging Face Spaces.## Usage**Endpoint:** `/api/seo-report`**Parameters:**- `domain`: The URL to scrape (e.g., `https://www.google.com`)- `limit`: Max pages to scan (default: 25)**Example:**https://ubuntu593-alt-scraper-api.hf.space/api/seo-report?domain=https://www.google.com&limit=5123454 unmodified lines1011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677---title: Alt Scraper APIemoji: 🕷️colorFrom: purplecolorTo: blue4 unmodified lines# Alt Scraper APIA robust SEO scraping API built with FastAPI, Playwright, and advanced anti-bot bypass. Deployable on Hugging Face Spaces.## 🚀 Quick Start### Health Check```GET https://ubuntu593-alt-scraper-api.hf.space/health```### Start a Scan```POST https://ubuntu593-alt-scraper-api.hf.space/api/scanstart?domain=https://example.com&limit=25```Or with JSON body:```bashcurl -X POST "https://ubuntu593-alt-scraper-api.hf.space/api/scanstart" \-H "Content-Type: application/json" \-d '{"domain": "https://example.com", "limit": 25}'```**Response**: `{"job_id": "abc-123..."}`### Check Progress```GET https://ubuntu593-alt-scraper-api.hf.space/api/progress?job_id=YOUR_JOB_ID```### Get Results```GET https://ubuntu593-alt-scraper-api.hf.space/api/result?job_id=YOUR_JOB_ID```## 📋 Complete API ReferenceSee [COMPLETE_API_REFERENCE.md](./COMPLETE_API_REFERENCE.md) for full documentation.## 🔧 Features- **Tiered Fetching Strategy**: curl_cffi → cloudscraper → Playwright- **Anti-Bot Bypass**: Playwright Stealth mode with countermeasures- **Real-time Progress**: WebSocket-like progress tracking- **Async Processing**: Background job queue with FastAPI- **Comprehensive Analysis**: Image ALT text, quality checks, and more## 🛠️ Endpoints| Endpoint | Method | Description ||----------|--------|-------------|| `/health` | GET | System health check || `/api/status` | GET | Server status & connectivity || `/api/scanstart` | POST | Start new scan job || `/api/progress` | GET | Check scan progress || `/api/result` | GET | Get scan results |## 📦 DeploymentThis app uses Docker and is configured for Hugging Face Spaces.**Requirements**:- Python 3.10+- Playwright browsers- FastAPI + UvicornSee [Dockerfile](./Dockerfile) for deployment configuration.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111import requestsimport timeimport json
print("=" * 60)print("🚀 HUGGING FACE DEPLOYMENT VERIFICATION")print("=" * 60)print()
BASE_URL = "https://ubuntu593-alt-scraper-api.hf.space"
# Test 1: Health Checkprint("Test 1: Health Check")print(f"URL: {BASE_URL}/health")try: r = requests.get(f"{BASE_URL}/health", timeout=10) print(f"Status: {r.status_code}") print(f"Response: {r.text}") if r.status_code == 200: print("✅ PASSED") else: print("❌ FAILED")except Exception as e: print(f"❌ ERROR: {e}")print()
# Test 2: System Statusprint("Test 2: System Status")print(f"URL: {BASE_URL}/api/status")try: r = requests.get(f"{BASE_URL}/api/status", timeout=10) print(f"Status: {r.status_code}") if r.status_code == 200: print(f"Response: {json.dumps(r.json(), indent=2)}") print("✅ PASSED") else: print(f"Response: {r.text[:200]}") print("❌ FAILED")except Exception as e: print(f"❌ ERROR: {e}")print()
# Test 3: Start Scan (Query Params)print("Test 3: Start Scan (Query Parameters)")print(f"URL: {BASE_URL}/api/scanstart?domain=https://example.com&limit=3")try: r = requests.post(f"{BASE_URL}/api/scanstart?domain=https://example.com&limit=3", timeout=10) print(f"Status: {r.status_code}") if r.status_code == 200: response = r.json() print(f"Response: {json.dumps(response, indent=2)}") print("✅ PASSED") job_id = response.get("job_id") if job_id: # Test 4: Check Progress print() print("Test 4: Check Progress") print(f"URL: {BASE_URL}/api/progress?job_id={job_id}") time.sleep(2) # Wait a bit r2 = requests.get(f"{BASE_URL}/api/progress?job_id={job_id}", timeout=10) print(f"Status: {r2.status_code}") if r2.status_code == 200: print(f"Response: {json.dumps(r2.json(), indent=2)}") print("✅ PASSED") else: print(f"Response: {r2.text[:200]}") print("❌ FAILED") else: print(f"Response: {r.text[:300]}") print("❌ FAILED - This is the issue you're seeing!") print() print("💡 SOLUTION:") print("1. Go to: https://huggingface.co/spaces/ubuntu593/alt-scraper-api/settings") print("2. Scroll down to find 'Factory Reboot' button") print("3. Click it and wait 3-5 minutes for rebuild") print("4. Run this script again")except Exception as e: print(f"❌ ERROR: {e}")print()
# Test 5: Start Scan (JSON Body)print("Test 5: Start Scan (JSON Body)")print(f"URL: {BASE_URL}/api/scanstart")try: r = requests.post( f"{BASE_URL}/api/scanstart", json={"domain": "https://example.com", "limit": 3}, timeout=10 ) print(f"Status: {r.status_code}") if r.status_code == 200: print(f"Response: {json.dumps(r.json(), indent=2)}") print("✅ PASSED") else: print(f"Response: {r.text[:200]}") print("❌ FAILED")except Exception as e: print(f"❌ ERROR: {e}")print()
print("=" * 60)print("VERIFICATION COMPLETE")print("=" * 60)print()print("If you see 404 errors above:")print("→ Your HF Space needs to rebuild with latest code")print("→ Follow the solution steps shown above")print()print("If all tests pass:")print("→ Your deployment is working perfectly! ✅")HF_DEPLOYMENT_STATUS.mdAdded+223
README.md+62-9
verify_hf_deployment.pyAdded+111