|
"""
|
|
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()
|
|
|
|
|
|
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):
|
|
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")
|
|
|