Speedofmastery commited on
Commit
0d64359
·
1 Parent(s): 743b049

Auto-commit: upload_to_space.py updated

Browse files
Files changed (1) hide show
  1. upload_to_space.py +42 -0
upload_to_space.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Upload files directly to Hugging Face Space using API
3
+ """
4
+ import requests
5
+ from pathlib import Path
6
+
7
+ SPACE_ID = "Speedofmastery/HMM"
8
+ API_URL = f"https://huggingface.co/api/spaces/{SPACE_ID}"
9
+
10
+ # Files to upload
11
+ files_to_upload = [
12
+ ("Dockerfile", "Dockerfile"),
13
+ ("app.py", "app.py"),
14
+ ("requirements.txt", "requirements.txt"),
15
+ ("README.md", "README.md")
16
+ ]
17
+
18
+ print("📤 Uploading files to Space...")
19
+ print(f"Space: {SPACE_ID}\n")
20
+
21
+ for filename, source_file in files_to_upload:
22
+ file_path = Path(source_file)
23
+
24
+ if not file_path.exists():
25
+ print(f"❌ {source_file} not found")
26
+ continue
27
+
28
+ size = file_path.stat().st_size
29
+ print(f"📄 {filename} ({size:,} bytes)")
30
+
31
+ print("\n⚠️ Manual upload required - API token invalid")
32
+ print("\nGo to browser and:")
33
+ print("1. Files tab -> Add file -> Upload files")
34
+ print("2. Drag and drop from D:\\sand\\docker-sandbox-space\\")
35
+ print(" - Dockerfile")
36
+ print(" - app.py")
37
+ print(" - requirements.txt")
38
+ print("3. Settings -> SDK -> Docker -> Save")
39
+ print("\nOR use valid token with git:")
40
+ print("cd D:\\sand\\docker-sandbox-space")
41
+ print("git remote set-url origin https://USER:TOKEN@huggingface.co/spaces/Speedofmastery/HMM")
42
+ print("git push origin main")