SIngtel-Bill-Scanner / force_update.py
Cosmo125's picture
Upload 26 files
795183d verified
from huggingface_hub import HfApi
import os
def force_update_space():
"""Force update the Hugging Face Space with latest content"""
print("πŸš€ FORCE UPDATING HUGGING FACE SPACE")
print("=" * 50)
try:
token = os.getenv("HF_TOKEN")
api = HfApi(token=token)
# Test login
user_info = api.whoami()
print(f"βœ… Logged in as: {user_info['name']}")
print("\nπŸ“€ Force uploading all files...")
# Upload with force overwrite
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/",
"check_space.py",
"force_update.py"
],
commit_message="πŸ”„ Force update: Fix README and Streamlit app functionality",
delete_patterns="*" # This will replace all files
)
print("\nπŸŽ‰ SUCCESS! Force update completed!")
print("πŸ”— Check your space: https://huggingface.co/spaces/Cosmo125/Singtel_Bill_Scanner")
print("⏳ Allow 2-3 minutes for the app to rebuild")
return True
except Exception as e:
print(f"❌ Force update failed: {e}")
return False
if __name__ == "__main__":
force_update_space()