Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Deploy Sundew Diabetes Watch to Hugging Face Spaces | |
| """ | |
| import os | |
| from pathlib import Path | |
| from huggingface_hub import HfApi, login | |
| def deploy(): | |
| print("πΏ Sundew Diabetes Watch - Hugging Face Deployment") | |
| print("=" * 60) | |
| # Check if already logged in | |
| try: | |
| api = HfApi() | |
| whoami = api.whoami() | |
| print(f"β Already logged in as: {whoami['name']}") | |
| except: | |
| print("\nπ Please login to Hugging Face:") | |
| print(" Get your token from: https://huggingface.co/settings/tokens") | |
| print(" (You need a token with WRITE permissions)") | |
| print() | |
| login() | |
| print("β Login successful!") | |
| # Upload files | |
| repo_id = "mgbam/sundew_diabetes_watch" | |
| repo_type = "space" | |
| print(f"\nπ€ Uploading to {repo_id}...") | |
| files_to_upload = [ | |
| "app_advanced.py", | |
| "app.py", | |
| "requirements.txt", | |
| "Dockerfile", | |
| "README.md", | |
| ".streamlit/config.toml", | |
| ] | |
| base_path = Path(__file__).parent | |
| for file in files_to_upload: | |
| file_path = base_path / file | |
| if file_path.exists(): | |
| print(f" β {file}") | |
| try: | |
| api.upload_file( | |
| path_or_fileobj=str(file_path), | |
| path_in_repo=file, | |
| repo_id=repo_id, | |
| repo_type=repo_type, | |
| ) | |
| except Exception as e: | |
| print(f" β Warning: {e}") | |
| else: | |
| print(f" β {file} (not found)") | |
| print("\nβ Deployment complete!") | |
| print(f"π Your Space: https://huggingface.co/spaces/{repo_id}") | |
| print("\nβ³ Docker build will start automatically (5-10 minutes)") | |
| print(f"π Monitor build: https://huggingface.co/spaces/{repo_id}/logs") | |
| print("\nπ Once built, the ADVANCED app will be live!") | |
| if __name__ == "__main__": | |
| deploy() | |