|
"""
|
|
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!")
|
|
|
|
|
|
try:
|
|
from PIL import Image
|
|
print("β
PIL (Pillow) is available!")
|
|
|
|
|
|
img = Image.new('RGB', (200, 100), color='white')
|
|
img.save('test_image.png')
|
|
print("β
Can create and save images!")
|
|
|
|
|
|
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)
|
|
|
|
|
|
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)
|
|
|
|
|
|
import re
|
|
|
|
|
|
account_match = re.search(r'Account Number:\s*([0-9-]+)', sample_bill_text)
|
|
account = account_match.group(1) if account_match else "Not found"
|
|
|
|
|
|
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"
|
|
|
|
|
|
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__":
|
|
|
|
if test_basic_functionality():
|
|
print("\n" + "β
SUCCESS! Your environment is ready!")
|
|
|
|
|
|
demonstrate_text_processing()
|
|
|
|
|
|
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...")
|
|
|