File size: 1,642 Bytes
bf7fc70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/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()