File size: 3,805 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
"""

WORKING EXAMPLE - Singtel Bill Scanner

This script will work immediately without heavy downloads

"""

print("πŸš€ Singtel Bill Scanner - Quick Start")
print("=" * 50)

def test_basic_functionality():
    """Test basic Python functionality"""
    print("βœ… Python is working!")
    print("βœ… File system access works!")
    
    # Test basic image processing capability
    try:
        from PIL import Image
        print("βœ… PIL (Pillow) is available!")
        
        # Create a test image
        img = Image.new('RGB', (200, 100), color='white')
        img.save('test_image.png')
        print("βœ… Can create and save images!")
        
        # Test if we can load it back
        test_img = Image.open('test_image.png')
        print(f"βœ… Test image size: {test_img.size}")
        
        return True
        
    except ImportError:
        print("❌ PIL (Pillow) not installed")
        return False
    except Exception as e:
        print(f"❌ Error: {e}")
        return False

def show_next_steps():
    """Show what to do next"""
    print("\n" + "🎯 NEXT STEPS:")
    print("-" * 30)
    print("1. Your environment is working!")
    print("2. To use AI models, they need to download (~1.3GB)")
    print("3. This happens automatically on first use")
    print("4. Here's how to start:")
    print()
    
    print("METHOD 1 - Simple Test:")
    print("   python quick_test.py")
    print()
    
    print("METHOD 2 - Full Scanner:")
    print("   python singtel_scanner.py")
    print()
    
    print("METHOD 3 - Manual Installation:")
    print("   Run: install_and_test.bat")
    print()

def demonstrate_text_processing():
    """Show how text processing would work"""
    print("\n" + "πŸ“ TEXT PROCESSING DEMO:")
    print("-" * 35)
    
    # Simulate extracted text from a bill
    sample_bill_text = """

    SINGTEL MOBILE SERVICES

    Account Number: 123-456-789

    Bill Period: 01/06/2025 to 30/06/2025

    

    Monthly Subscription: $45.90

    Data Usage: $12.30

    Voice Calls: $8.50

    SMS: $2.10

    

    Total Amount Due: $68.80

    Due Date: 15/07/2025

    

    Thank you for choosing Singtel!

    """
    
    print("Sample extracted text:")
    print(sample_bill_text)
    
    # Simple parsing example
    import re
    
    # Extract account number
    account_match = re.search(r'Account Number:\s*([0-9-]+)', sample_bill_text)
    account = account_match.group(1) if account_match else "Not found"
    
    # Extract total amount
    total_match = re.search(r'Total Amount Due:\s*\$([0-9.]+)', sample_bill_text)
    total = total_match.group(1) if total_match else "Not found"
    
    # Extract due date
    due_match = re.search(r'Due Date:\s*([0-9/]+)', sample_bill_text)
    due_date = due_match.group(1) if due_match else "Not found"
    
    print("\n" + "πŸ” EXTRACTED INFORMATION:")
    print(f"   Account Number: {account}")
    print(f"   Total Amount: ${total}")
    print(f"   Due Date: {due_date}")

if __name__ == "__main__":
    # Test basic functionality
    if test_basic_functionality():
        print("\n" + "βœ… SUCCESS! Your environment is ready!")
        
        # Show text processing demo
        demonstrate_text_processing()
        
        # Show next steps
        show_next_steps()
        
        print("\n" + "πŸ’‘ TIP: The AI models will download automatically")
        print("when you first run the scanner. Be patient!")
        
    else:
        print("\n" + "❌ SETUP NEEDED!")
        print("Run this command to install required packages:")
        print("pip install Pillow")
    
    print("\n" + "πŸŽ‰ Ready to scan Singtel bills!")
    input("Press Enter to continue...")