File size: 749 Bytes
0256284
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""
Script to upload stamp_model.pt to Hugging Face Space.
Run this after the Space is created to upload the model file.
"""
from huggingface_hub import HfApi, login
from pathlib import Path

# Login (will prompt for token if not already logged in)
# Or set HF_TOKEN environment variable
login()

api = HfApi()
model_path = Path("stamp_detector/stamp_model.pt")

if not model_path.exists():
    print(f"Error: {model_path} not found!")
    exit(1)

print(f"Uploading {model_path} to bekzhanK1/armeta_hackaton...")
api.upload_file(
    path_or_fileobj=str(model_path),
    path_in_repo="stamp_detector/stamp_model.pt",
    repo_id="bekzhanK1/armeta_hackaton",
    repo_type="space"
)
print("✓ Model uploaded successfully!")