#!/usr/bin/env python3 from huggingface_hub import HfApi import os # Create Gradio-based HuggingFace Space api = HfApi() try: # Create README for Gradio version readme_content = """--- title: STT GPU Service - Gradio Test emoji: 🎙️ colorFrom: blue colorTo: green sdk: gradio sdk_version: 4.8.0 app_file: app_gradio.py pinned: false hardware: t4-small sleep_time_timeout: 1800 --- # 🎙️ STT GPU Service - Gradio Test Test deployment using Gradio interface to verify HuggingFace Spaces functionality. ## Status This is a working test version to validate deployment infrastructure. The actual STT model will be integrated after successful deployment. ## Features (Placeholder) - Health check endpoint - File upload interface - Streaming audio interface - Service monitoring Once this deploys successfully, we'll add the Moshi STT model integration. """ with open('README_gradio.md', 'w') as f: f.write(readme_content) # Create the Gradio space space_url = api.create_repo( repo_id="pgits/stt-gpu-service-gradio-test", repo_type="space", exist_ok=True, space_sdk="gradio", space_hardware="t4-small", space_sleep_time=1800 ) print(f"Gradio Space created: {space_url}") # Upload Gradio files files_to_upload = [ ("app_gradio.py", "app.py"), ("requirements_gradio.txt", "requirements.txt"), ("README_gradio.md", "README.md") ] for local_file, repo_file in files_to_upload: if os.path.exists(local_file): print(f"Uploading {local_file} as {repo_file}...") api.upload_file( path_or_fileobj=local_file, path_in_repo=repo_file, repo_id="pgits/stt-gpu-service-gradio-test", repo_type="space" ) print(f"✓ {repo_file} uploaded") else: print(f"⚠️ {local_file} not found") print("🚀 Gradio Space deployment completed!") print(f"URL: https://huggingface.co/spaces/pgits/stt-gpu-service-gradio-test") except Exception as e: print(f"Error: {e}")