File size: 3,343 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 |
"""
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...")
|