File size: 1,155 Bytes
2a762ba | 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 | """Deployment script for Hugging Face Spaces."""
import os
import subprocess
def deploy():
"""Deploy to Hugging Face Spaces using git push."""
repo_id = os.environ.get("HF_REPO_ID", "your-username/pinnacle-voice-analysis")
print(f"Deploying to {repo_id}...")
# Ensure app.py exists at root
if not os.path.exists("app.py"):
raise FileNotFoundError("app.py not found at repository root")
# Create README for Spaces if not exists
readme_path = "README.md"
if not os.path.exists(readme_path):
with open(readme_path, "w") as f:
f.write(f"""---
title: Pinnacle Voice Analysis
emoji: microphone
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 4.0.0
app_file: app.py
pinned: false
license: apache-2.0
---
# Pinnacle Voice Analysis Engine
Scientific voice analysis platform. Upload audio or record directly.
""")
subprocess.run(["git", "add", "."], check=True)
subprocess.run(["git", "commit", "-m", "Deploy to HF Spaces"], check=False)
subprocess.run(["git", "push", "origin", "main"], check=True)
print("Deployment complete!")
if __name__ == "__main__":
deploy()
|