Spaces:
Sleeping
Sleeping
File size: 1,250 Bytes
0d64359 |
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 |
"""
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")
|