| # 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 | |