from huggingface_hub import HfApi | |
from transformers import TrOCRProcessor, VisionEncoderDecoderModel | |
# Define your Hugging Face API token and repo ID | |
hf_token = "your_huggingface_token" | |
repo_id = "your_username/trocr-finetuned-funsd" | |
# Initialize HfApi | |
api = HfApi() | |
api.login(hf_token) | |
# Define the folder path | |
folder_path = "./trocr-finetuned-funsd" | |
# Upload the model | |
api.upload_folder( | |
folder_path=folder_path, | |
repo_id=repo_id, | |
repo_type="model", | |
path_in_repo=".", | |
) | |
print(f"Model uploaded to {repo_id}") |