import requests import time print("Waiting for Hugging Face Space to rebuild (this takes 2-3 minutes)...") print("Checking every 30 seconds...\n") base_url = "https://ranar118-voice-detection.hf.space" max_attempts = 10 attempt = 0 while attempt < max_attempts: attempt += 1 print(f"Attempt {attempt}/{max_attempts}...") try: response = requests.get(f"{base_url}/", timeout=15) if response.status_code == 200: # Check if HTML has been updated if '/detect' in response.text and 'http://127.0.0.1:8000' not in response.text: print("\n" + "="*60) print("✅ SUCCESS! The site has been updated!") print("="*60) print("\nThe network error should now be fixed.") print("Please try accessing the site again:") print(f" {base_url}") print("\nIf you still see an error, try:") print(" 1. Hard refresh your browser (Ctrl+Shift+R or Ctrl+F5)") print(" 2. Clear your browser cache") print(" 3. Try in an incognito/private window") break elif 'http://127.0.0.1:8000' in response.text: print(" ⏳ Still has old localhost URL, waiting for rebuild...") else: print(" ⏳ Checking...") else: print(f" Status: {response.status_code}") except Exception as e: print(f" Error: {e}") if attempt < max_attempts: print(" Waiting 30 seconds before next check...\n") time.sleep(30) else: print("\n⚠️ Rebuild is taking longer than expected.") print("Please wait a few more minutes and check manually:") print(f" {base_url}")