File size: 734 Bytes
bab893b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Save this as create_repo.py
from huggingface_hub import HfApi, create_repo

# Initialize the Hugging Face API
api = HfApi()

# Create your repository
# The repo_id follows the format: "username/model-name"
repo_id = "chinmays18/llm-knowledge-assistant-8b"

try:
    # Create a public model repository
    repo_url = create_repo(
        repo_id=repo_id,
        repo_type="model",  # Specifies this is a model, not a dataset or space
        private=False       # Make it public so others can use your model
    )
    print(f"✅ Successfully created repository at: {repo_url}")
except Exception as e:
    print(f"❌ Error creating repository: {e}")
    # This might happen if the repo already exists or there's a connection issue