39 lines
914 B
Python
39 lines
914 B
Python
from pathlib import Path
|
|
|
|
from huggingface_hub import HfApi, create_repo
|
|
|
|
|
|
REPO_ID = "Syndria98/ultimate-tic-tac-toe-ai"
|
|
|
|
FILES_TO_UPLOAD = {
|
|
"model.py": "model.py",
|
|
"game.py": "game.py",
|
|
"run.py": "run.py",
|
|
"README.md": "README.md",
|
|
"easy.pth": "models/easy.pth",
|
|
"medium.pth": "models/medium.pth",
|
|
"hard.pth": "models/hard.pth",
|
|
}
|
|
|
|
|
|
def main():
|
|
create_repo(repo_id=REPO_ID, repo_type="model", exist_ok=True)
|
|
api = HfApi()
|
|
|
|
for local_path, repo_path in FILES_TO_UPLOAD.items():
|
|
path = Path(local_path)
|
|
if not path.exists():
|
|
raise FileNotFoundError(f"Missing file: {local_path}")
|
|
|
|
api.upload_file(
|
|
path_or_fileobj=str(path),
|
|
path_in_repo=repo_path,
|
|
repo_id=REPO_ID,
|
|
repo_type="model",
|
|
)
|
|
print(f"Uploaded {local_path} -> {repo_path}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|