stt-gpu-service-python-v4 / create_space.py
Peter Michael Gits
Add HuggingFace Space creation script
624ed9b
#!/usr/bin/env python3
from huggingface_hub import HfApi
import os
# Create HuggingFace Space
api = HfApi()
try:
# Create the space
space_url = api.create_repo(
repo_id="pgits/stt-gpu-service-python-v4",
repo_type="space",
exist_ok=True,
space_sdk="docker",
space_hardware="t4-small",
space_sleep_time=1800 # 30 minutes
)
print(f"Space created successfully: {space_url}")
# Upload all files
files_to_upload = [
"app.py",
"requirements.txt",
"Dockerfile",
"README.md",
".space_config.yaml"
]
for file in files_to_upload:
if os.path.exists(file):
print(f"Uploading {file}...")
api.upload_file(
path_or_fileobj=file,
path_in_repo=file,
repo_id="pgits/stt-gpu-service-python-v4",
repo_type="space"
)
print(f"✓ {file} uploaded")
else:
print(f"⚠️ {file} not found")
print("🚀 Space deployment completed!")
print(f"URL: https://huggingface.co/spaces/pgits/stt-gpu-service-python-v4")
except Exception as e:
print(f"Error: {e}")