import os | |
from huggingface_hub import HfApi | |
# Initialize the Hugging Face API client | |
api = HfApi(token=os.getenv("HF_TOKEN")) | |
# Create the repository if it doesn't exist | |
try: | |
api.create_repo(repo_id="JoydeepC/trueGL", repo_type="model", private=False) | |
print("Repository created successfully!") | |
except Exception as e: | |
print(f"Repository already exists or error: {e}") | |
# Upload the model folder to the Hugging Face Hub | |
api.upload_folder( | |
folder_path="E:\model_us", | |
repo_id="JoydeepC/trueGL", | |
repo_type="model", | |
commit_message="Upload fine-tuned trueGL model", | |
create_pr=False | |
) | |
print("Model uploaded successfully to JoydeepC/trueGL!") |