9027941P / upload_huggingface.py
mail2kandan's picture
Add object detection model for guitars and wristwatches with Gradio interface
17f3279
raw
history blame contribute delete
951 Bytes
import os
from huggingface_hub import HfApi, create_repo
model_path = r'C:\Manikandan\NYP\ITI107\Assignment_draft\output_models\best_openvino_model'
model_name = 'mail2kandan/guitar_watch_openvino_model'
# Initialize API
api = HfApi()
# Delete existing repository
api.delete_repo(repo_id=model_name)
# Create repository (replace with your Hugging Face username and model name)
create_repo(model_name, exist_ok=True)
# Upload files
api.upload_file(
path_or_fileobj=os.path.join(model_path, 'best.bin'),
path_in_repo='best.bin',
repo_id=model_name,
commit_message="Upload best.bin"
)
api.upload_file(
path_or_fileobj=os.path.join(model_path, 'best.xml'),
path_in_repo='best.xml',
repo_id=model_name,
commit_message="Upload best.xml"
)
api.upload_file(
path_or_fileobj=os.path.join(model_path, 'metadata.yaml'),
path_in_repo='metadata.yaml',
repo_id=model_name,
commit_message="Upload metadata.yaml"
)