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