SIngtel-Bill-Scanner / upload_to_singtel_space.py
Cosmo125's picture
Upload 26 files
795183d verified
"""
Upload to specific Hugging Face Space: singtel_bill_scanner
"""
import os
from huggingface_hub import HfApi
def upload_to_singtel_space():
"""Upload specifically to the singtel_bill_scanner space"""
print("πŸš€ UPLOADING TO SINGTEL_BILL_SCANNER SPACE")
print("=" * 50)
try:
# Check token
token = os.getenv("HF_TOKEN")
if not token:
print("❌ HF_TOKEN environment variable not set")
print("Please set your Hugging Face token first")
return False
api = HfApi(token=token)
# Verify login
try:
user_info = api.whoami()
print(f"βœ… Logged in as: {user_info['name']}")
except Exception as e:
print(f"❌ Token invalid: {e}")
return False
print("\nπŸ“ Preparing upload...")
print("🎯 Target: Cosmo125/singtel_bill_scanner")
print("πŸ“¦ Type: Hugging Face Space (Web App)")
# Upload to the specific space
api.upload_folder(
folder_path=".",
repo_id="Cosmo125/singtel_bill_scanner",
repo_type="space",
ignore_patterns=[
"*.pyc",
"__pycache__/",
".venv/",
"test_*.png",
"test_*.jpg",
"sample_*.jpg",
"*.log",
".git/",
"deployment_summary.py",
"spaces_monitor.py"
],
commit_message="πŸš€ Deploy Singtel Bill Scanner to singtel_bill_scanner space"
)
print("\nπŸŽ‰ SUCCESS! Upload completed!")
print("=" * 60)
print("πŸ”— Your Singtel Bill Scanner is now live at:")
print(" https://huggingface.co/spaces/Cosmo125/singtel_bill_scanner")
print()
print("πŸ“± Space Features:")
print(" ✨ Live web interface for bill scanning")
print(" πŸ” Upload bill images and get instant OCR")
print(" πŸ“Š Automatic parsing of amounts, dates, accounts")
print(" πŸ’Ύ JSON export of extracted data")
print(" πŸ”’ Privacy-first (images not stored)")
print()
print("⏰ Deployment Timeline:")
print(" πŸ“€ Upload: COMPLETE βœ…")
print(" πŸ”¨ Build: 2-3 minutes")
print(" πŸš€ Live: Ready soon!")
print()
print("πŸ’‘ Next Steps:")
print(" 1. Visit the URL above")
print(" 2. Wait for 'Building...' to complete")
print(" 3. Upload a Singtel bill to test!")
print("=" * 60)
return True
except Exception as e:
print(f"\n❌ Upload failed: {e}")
print("\nπŸ”§ Troubleshooting:")
print("1. Check internet connection")
print("2. Verify HF token permissions")
print("3. Ensure space name is available")
return False
if __name__ == "__main__":
success = upload_to_singtel_space()
if success:
print("\n🎯 Ready to go! Check the URL above in 2-3 minutes.")
else:
print("\n❌ Upload failed. Check the error messages above.")
input("\nPress Enter to exit...")