|
"""
|
|
Monitor the Hugging Face Spaces upload and deployment
|
|
"""
|
|
|
|
import time
|
|
import requests
|
|
|
|
def check_space_status(repo_id="Cosmo125/Singtel_Bill_Scanner"):
|
|
"""Check if the Hugging Face Space is live"""
|
|
try:
|
|
url = f"https://huggingface.co/spaces/{repo_id}"
|
|
response = requests.get(url, timeout=10)
|
|
|
|
if response.status_code == 200:
|
|
if "Building" in response.text:
|
|
return "building"
|
|
elif "Runtime error" in response.text:
|
|
return "error"
|
|
else:
|
|
return "live"
|
|
else:
|
|
return "not_found"
|
|
except Exception:
|
|
return "checking"
|
|
|
|
def monitor_deployment():
|
|
"""Monitor the deployment progress"""
|
|
print("π HUGGING FACE SPACES DEPLOYMENT MONITOR")
|
|
print("=" * 50)
|
|
|
|
repo_id = "Cosmo125/Singtel_Bill_Scanner"
|
|
space_url = f"https://huggingface.co/spaces/{repo_id}"
|
|
|
|
print(f"π± Space URL: {space_url}")
|
|
print("β³ Monitoring deployment status...")
|
|
print()
|
|
|
|
for i in range(20):
|
|
status = check_space_status(repo_id)
|
|
timestamp = time.strftime("%H:%M:%S")
|
|
|
|
if status == "live":
|
|
print(f"π [{timestamp}] SUCCESS! Your app is LIVE!")
|
|
print("β
Deployment completed successfully!")
|
|
break
|
|
elif status == "building":
|
|
print(f"π¨ [{timestamp}] Building... (this is normal)")
|
|
elif status == "error":
|
|
print(f"β [{timestamp}] Runtime error detected")
|
|
print("π‘ Check the logs at the space URL")
|
|
break
|
|
elif status == "not_found":
|
|
print(f"π€ [{timestamp}] Upload in progress...")
|
|
else:
|
|
print(f"π [{timestamp}] Checking status...")
|
|
|
|
if i < 19:
|
|
time.sleep(30)
|
|
|
|
print(f"\nπ Visit your space: {space_url}")
|
|
print("π‘ If still building, wait a few more minutes and refresh")
|
|
|
|
def show_quick_status():
|
|
"""Show quick status without monitoring"""
|
|
print("π± SINGTEL BILL SCANNER - SPACES STATUS")
|
|
print("=" * 45)
|
|
|
|
repo_id = "Cosmo125/Singtel_Bill_Scanner"
|
|
space_url = f"https://huggingface.co/spaces/{repo_id}"
|
|
|
|
print(f"π Space URL: {space_url}")
|
|
print()
|
|
|
|
status = check_space_status(repo_id)
|
|
|
|
if status == "live":
|
|
print("π STATUS: LIVE AND READY!")
|
|
print("β
Your app is working and accessible")
|
|
elif status == "building":
|
|
print("π¨ STATUS: BUILDING...")
|
|
print("β³ Please wait 2-3 more minutes")
|
|
elif status == "error":
|
|
print("β STATUS: ERROR")
|
|
print("π§ Check the space for error details")
|
|
elif status == "not_found":
|
|
print("π€ STATUS: UPLOAD IN PROGRESS")
|
|
print("β³ Still uploading files to Hugging Face")
|
|
else:
|
|
print("π STATUS: CHECKING...")
|
|
print("β³ Unable to determine status right now")
|
|
|
|
print()
|
|
print("π― What to expect:")
|
|
print(" π€ Upload: Files being transferred")
|
|
print(" π¨ Building: Installing dependencies")
|
|
print(" π Live: Ready for use!")
|
|
|
|
if __name__ == "__main__":
|
|
import sys
|
|
|
|
if len(sys.argv) > 1 and sys.argv[1] == "monitor":
|
|
monitor_deployment()
|
|
else:
|
|
show_quick_status()
|
|
|
|
choice = input("\nStart continuous monitoring? (y/n): ").lower()
|
|
if choice in ['y', 'yes']:
|
|
print("\n" + "="*50)
|
|
monitor_deployment()
|
|
else:
|
|
print("π‘ Run 'python spaces_monitor.py monitor' for continuous monitoring")
|
|
|