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