File size: 1,492 Bytes
058ba59 75224c7 058ba59 75224c7 058ba59 | 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
"""
Push AmkyawDev-LLM-V3 to Hugging Face Spaces
Creates a Gradio Space for the Burmese Language Model
"""
import os
from huggingface_hub import HfApi, login
def create_space():
"""Create and push the Gradio Space to Hugging Face."""
# Get token from environment
token = os.environ.get("HF_TOKEN")
if not token:
print("Error: No Hugging Face token found.")
print("Please set HF_TOKEN environment variable")
return
# Login
print("Logging in to Hugging Face...")
login(token=token)
# Initialize API
api = HfApi()
repo_id = "amkyawdev/AmkyawDev-LLM-V3"
# Create Space repository (if not exists)
print(f"Creating Space: {repo_id}")
try:
api.create_repo(
repo_id=repo_id,
repo_type="space",
space_sdk="gradio",
)
except Exception as e:
if "409" in str(e) or "already created" in str(e).lower():
print(f"Space already exists, skipping creation...")
else:
raise
# Upload files to Space
print("Uploading web_ui files to Space...")
api.upload_folder(
folder_path="deployment/web_ui",
repo_id=repo_id,
repo_type="space",
commit_message="Initial Space upload"
)
print(f"✅ Successfully created Space!")
print(f" URL: https://huggingface.co/spaces/{repo_id}")
if __name__ == "__main__":
create_space() |