voice_detection / check_rebuild.py
ranar110
Fix: Use absolute path for tester.html and add path debugging
f6d50b1
import requests
import time
print("Checking Hugging Face Space rebuild status...")
print("=" * 60)
base_url = "https://ranar118-voice-detection.hf.space"
for attempt in range(1, 11):
print(f"\nAttempt {attempt}/10 (waiting 20 seconds between checks)...")
try:
response = requests.get(f"{base_url}/", timeout=15)
if response.status_code == 200:
# Check if HTML has been updated
has_relative_url = '/detect' in response.text
has_localhost = 'http://127.0.0.1:8000' in response.text
print(f" Status: {response.status_code} OK")
print(f" Has '/detect': {has_relative_url}")
print(f" Has localhost URL: {has_localhost}")
if has_relative_url and not has_localhost:
print("\n" + "=" * 60)
print("✅ SUCCESS! The site has been updated!")
print("=" * 60)
print("\nThe network error is now fixed!")
print(f"Visit: {base_url}")
print("\nIf you still see issues, try:")
print(" - Hard refresh (Ctrl+Shift+R)")
print(" - Clear browser cache")
print(" - Use incognito mode")
break
elif has_localhost:
print(" ⏳ Still showing old version, rebuild in progress...")
else:
print(" ⚠️ Unexpected state")
else:
print(f" Status: {response.status_code}")
except requests.exceptions.Timeout:
print(" ⏳ Timeout - Space might be restarting...")
except Exception as e:
print(f" ⚠️ Error: {str(e)[:100]}")
if attempt < 10:
time.sleep(20)
else:
print("\n" + "=" * 60)
print("⏳ Rebuild is taking longer than expected")
print("=" * 60)
print("The Space is likely still building.")
print(f"Check manually: {base_url}")
print("Or visit: https://huggingface.co/spaces/ranar118/voice_detection")