#!/usr/bin/env python3 """ ZamAI Model Upload Script This script uploads the ZamAI Multilingual Embeddings model to Hugging Face Hub """ import os from huggingface_hub import HfApi, create_repo, upload_folder from pathlib import Path def upload_to_hf(): """Upload the ZamAI model to Hugging Face Hub""" # Read the HF token with open('HF-Token.txt', 'r') as f: token = f.read().strip() # Initialize HF API api = HfApi(token=token) # Repository details repo_id = "tasal9/Multilingual-ZamAI-Embeddings" repo_type = "model" print(f"🚀 Uploading ZamAI Multilingual Embeddings to {repo_id}") try: # Create repository if it doesn't exist create_repo( repo_id=repo_id, token=token, repo_type=repo_type, exist_ok=True, private=False ) print(f"✅ Repository {repo_id} is ready") # Upload the entire folder api.upload_folder( folder_path=".", repo_id=repo_id, repo_type=repo_type, token=token, commit_message="Upload ZamAI Multilingual Embeddings model", ignore_patterns=[".git/", "__pycache__/", "*.pyc", "HF-Token.txt", "chroma_db/"] ) print(f"🎉 Successfully uploaded to https://huggingface.co/{repo_id}") print("Your model is now live on Hugging Face Hub!") except Exception as e: print(f"❌ Error uploading to Hugging Face: {str(e)}") return False return True if __name__ == "__main__": upload_to_hf()