def push_to_hub()

in ember/create.py [0:0]


def push_to_hub(model_path: str, repo_id: str):
    token = os.environ.get("HF_TOKEN")
    if not token:
        raise ValueError("HF_TOKEN environment variable is not set")

    api = HfApi()

    print("Pushing model to Hugging Face Hub...")
    if not repo_exists(repo_id, token=token):
        create_repo(repo_id, private=True, token=token)

    model_path = os.path.abspath(model_path)
    api.upload_folder(
        folder_path=model_path,
        repo_id=repo_id,
        token=token,
    )
    print(f"Model pushed to Hugging Face Hub: {repo_id}")