AmkyawDev-LLM-V3 / scripts /push_space.py
amkyawdev's picture
Initial upload from AmkyawDev-LLM-V3
75224c7 verified
#!/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()