"""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()