File size: 4,244 Bytes
795183d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
"""
Monitor deployment status for Singtel_Bill_Scanner space
"""
import requests
import time
from datetime import datetime
def check_singtel_space_status():
"""Check the deployment status of Singtel_Bill_Scanner space"""
space_url = "https://huggingface.co/spaces/Cosmo125/Singtel_Bill_Scanner"
print("π SINGTEL_BILL_SCANNER DEPLOYMENT STATUS")
print("=" * 55)
print(f"π Space: Cosmo125/Singtel_Bill_Scanner")
print(f"π URL: {space_url}")
print(f"β° Check time: {datetime.now().strftime('%H:%M:%S')}")
print("-" * 55)
try:
print("π Checking space accessibility...")
response = requests.get(space_url, timeout=15)
if response.status_code == 200:
content = response.text.lower()
# Check for different states
if "building" in content:
print("π¨ STATUS: BUILDING β³")
print(" Installing dependencies and setting up environment")
print(" β° Estimated time: 2-5 more minutes")
elif "runtime error" in content or "error" in content:
print("β STATUS: ERROR")
print(" Something went wrong during deployment")
print(" π§ Check the logs in the space for details")
elif "streamlit" in content or "singtel" in content:
print("π STATUS: LIVE AND READY! β
")
print(" Your app is now accessible to users!")
print(" π Users can upload bills and get OCR results")
elif "starting" in content:
print("π STATUS: STARTING UP")
print(" App is initializing, almost ready!")
else:
print("π STATUS: LOADING")
print(" Space is responding but still setting up")
elif response.status_code == 404:
print("π€ STATUS: UPLOAD IN PROGRESS")
print(" Space not yet available, files still uploading")
else:
print(f"β³ STATUS: BUILDING (HTTP {response.status_code})")
print(" Space is being prepared")
except requests.exceptions.Timeout:
print("β³ STATUS: STILL BUILDING")
print(" Server is busy setting up your app")
except Exception as e:
print(f"π STATUS: CHECKING... ({str(e)[:50]})")
print(" Unable to get detailed status right now")
print("\n" + "π― WHAT TO EXPECT:")
print(" π€ Upload: Files being transferred")
print(" π¨ Build: Installing torch, transformers, streamlit")
print(" π€ Model: Setting up TrOCR and LayoutLM")
print(" π Live: Ready for bill scanning!")
print(f"\nπ‘ TIP: Visit {space_url} directly to see real-time status")
def quick_status():
"""Quick status check"""
print("π± Quick Status Check for Singtel_Bill_Scanner")
print("=" * 50)
check_singtel_space_status()
print("=" * 50)
if __name__ == "__main__":
quick_status()
print("\nπ Would you like to monitor continuously? (y/n): ", end="")
choice = input().lower().strip()
if choice in ['y', 'yes']:
print("\nπ Starting continuous monitoring...")
print("Press Ctrl+C to stop\n")
try:
for i in range(20): # Monitor for up to 10 minutes
print(f"\n--- Check #{i+1} ---")
check_singtel_space_status()
if i < 19:
print("\nβ³ Waiting 30 seconds for next check...")
time.sleep(30)
except KeyboardInterrupt:
print("\n\nβ Monitoring stopped by user")
print(f"\nπ― Final check: https://huggingface.co/spaces/Cosmo125/Singtel_Bill_Scanner")
else:
print("\nπ‘ Check the URL manually in a few minutes!")
print("π https://huggingface.co/spaces/Cosmo125/Singtel_Bill_Scanner")
|