Spaces:
Sleeping
Sleeping
| """ | |
| Upload files directly to Hugging Face Space using API | |
| """ | |
| import requests | |
| from pathlib import Path | |
| SPACE_ID = "Speedofmastery/HMM" | |
| API_URL = f"https://huggingface.co/api/spaces/{SPACE_ID}" | |
| # Files to upload | |
| files_to_upload = [ | |
| ("Dockerfile", "Dockerfile"), | |
| ("app.py", "app.py"), | |
| ("requirements.txt", "requirements.txt"), | |
| ("README.md", "README.md") | |
| ] | |
| print("๐ค Uploading files to Space...") | |
| print(f"Space: {SPACE_ID}\n") | |
| for filename, source_file in files_to_upload: | |
| file_path = Path(source_file) | |
| if not file_path.exists(): | |
| print(f"โ {source_file} not found") | |
| continue | |
| size = file_path.stat().st_size | |
| print(f"๐ {filename} ({size:,} bytes)") | |
| print("\nโ ๏ธ Manual upload required - API token invalid") | |
| print("\nGo to browser and:") | |
| print("1. Files tab -> Add file -> Upload files") | |
| print("2. Drag and drop from D:\\sand\\docker-sandbox-space\\") | |
| print(" - Dockerfile") | |
| print(" - app.py") | |
| print(" - requirements.txt") | |
| print("3. Settings -> SDK -> Docker -> Save") | |
| print("\nOR use valid token with git:") | |
| print("cd D:\\sand\\docker-sandbox-space") | |
| print("git remote set-url origin https://USER:TOKEN@huggingface.co/spaces/Speedofmastery/HMM") | |
| print("git push origin main") | |