# Create repo if not existing yet and get the associated repo_id
repo_id = api.create_repo(repo_name, exist_ok=True)

# Save all files in a temporary directory and push them in a single commit
with TemporaryDirectory() as tmpdir:
tmpdir = Path(tmpdir)

# Save weights
save_model(model, tmpdir / "model.safetensors")

# Generate model card
card = generate_model_card(model)
(tmpdir / "README.md").write_text(card)

# Save logs
# Save figures
# Save evaluation metrics
# ...