shuka-endpoint / deploy.py
shubham24's picture
Upload folder using huggingface_hub
5a67cd8 verified
import os
import subprocess
from huggingface_hub import HfApi
def deploy_endpoint():
# Initialize HF API
api = HfApi()
# Your organization name
org_name = "shubham24" # Your HF username
# Repository name
repo_name = "shuka-endpoint"
repo_id = f"{org_name}/{repo_name}"
# Create repository if it doesn't exist
try:
api.create_repo(
repo_id=repo_id,
repo_type="model",
exist_ok=True
)
except Exception as e:
print(f"Error creating repository: {e}")
return
# Push files to repository
try:
api.upload_folder(
folder_path=".",
repo_id=repo_id,
repo_type="model"
)
print(f"Successfully uploaded files to {repo_id}")
except Exception as e:
print(f"Error uploading files: {e}")
return
print("\nNext steps:")
print("1. Go to https://huggingface.co/spaces")
print("2. Click 'New Space'")
print("3. Select 'Inference Endpoint'")
print("4. Choose your repository")
print("5. Select A10 GPU (24GB)")
print("6. Set min_replicas=0, max_replicas=3")
print("7. Click 'Create Space'")
if __name__ == "__main__":
deploy_endpoint()