Kalletlamadhav/sql_optimized_env_new
0
1#!/usr/bin/env python32"""Quick diagnostic to check HuggingFace Space status."""3 4import requests5import time6 7BASE_URL = "https://kalletlamadhav-sql-optimized-env-new.hf.space"8 9print("="*70)10print("HUGGINGFACE SPACE DIAGNOSTIC")11print("="*70)12print(f"URL: {BASE_URL}")13print("\nAttempting connection...")14 15try:16 # Try with a very short timeout first17 print("\n1. Quick ping (5s timeout)...")18 response = requests.get(BASE_URL, timeout=5)19 print(f" ✅ Connected! Status: {response.status_code}")20 print(f" Content length: {len(response.text)} bytes")21 print(f" First 200 chars: {response.text[:200]}")22except requests.exceptions.Timeout:23 print(" ⏱️ Timeout - Space may be sleeping or slow")24except requests.exceptions.ConnectionError as e:25 print(f" ❌ Connection error: {e}")26except Exception as e:27 print(f" ❌ Error: {e}")28 29print("\n2. Trying /health endpoint (10s timeout)...")30try:31 response = requests.get(f"{BASE_URL}/health", timeout=10)32 print(f" ✅ Status: {response.status_code}")33 if response.status_code == 200:34 data = response.json()35 print(f" Response: {data}")36 else:37 print(f" Response: {response.text[:300]}")38except requests.exceptions.Timeout:39 print(" ⏱️ Timeout after 10s")40except Exception as e:41 print(f" ❌ Error: {e}")42 43print("\n" + "="*70)44print("RECOMMENDATIONS:")45print("="*70)46print("1. Visit the Space URL in your browser to wake it up:")47print(f" {BASE_URL}")48print("\n2. Check the Space logs on HuggingFace:")49print(f" https://huggingface.co/spaces/kalletlamadhav/sql-optimized-env-new")50print("\n3. Verify the Space is running (not building or crashed)")51print("\n4. If Space is sleeping, it may take 30-60s to wake up")52print("="*70)53 