kataria_opticals_api / hf_upload.py
codernotme's picture
update
7f3db4a verified
raw
history blame contribute delete
880 Bytes
import os
from huggingface_hub import HfApi, login
# 1. Login to Hugging Face
print("Please provide your Hugging Face WRITE token.")
login()
api = HfApi()
repo_id = "codernotme/kataria_optical"
# 2. Upload only the necessary model files
files_to_upload = {
"face_shape_model.pkl": "face_shape_model.pkl",
"lbfmodel.yaml": "lbfmodel.yaml"
}
print(f"Uploading model files to https://huggingface.co/{repo_id}...")
for local_file, repo_path in files_to_upload.items():
if os.path.exists(local_file):
print(f"Uploading {local_file}...")
api.upload_file(
path_or_fileobj=local_file,
path_in_repo=repo_path,
repo_id=repo_id,
repo_type="model"
)
else:
print(f"Error: {local_file} not found in ai_service directory!")
print("\nDone! Now your code can pull the model from Hugging Face.")