Spaces:
Sleeping
Sleeping
File size: 2,001 Bytes
ea7d209 |
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 |
#!/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()
|