# Deploying Anvaya Speech AI to Render This guide provides step-by-step instructions to deploy the **Anvaya Speech Pathology & Articulation Diagnostics** application on [Render](https://render.com). --- ## Deployment Architecture The application is containerized using a production `Dockerfile` optimized for Render: - **Base Image**: `python:3.11-slim-bookworm` with system audio libraries (`libsndfile1`, `ffmpeg`). - **CPU PyTorch Optimization**: Uses CPU-only PyTorch wheels to reduce the image size from ~4 GB to ~600 MB, fitting easily within Render memory limits. - **Model Pre-caching**: Base models are pre-cached inside the container during build time so the app boots instantly on Render. - **Dynamic Port Binding**: Automatically binds to Render's dynamic `$PORT` environment variable. --- ## Method 1: 1-Click Deployment via Render Blueprint (Recommended) Render provides an Infrastructure-as-Code Blueprint configured in [`render.yaml`](../render.yaml). ### Steps: 1. **Push your code to GitHub**: ```bash git add . git commit -m "feat: configure production Docker and Render deployment" git push origin main ``` 2. **Open Render Dashboard**: - Go to [dashboard.render.com](https://dashboard.render.com). - Click **New +** in the top right corner and select **Blueprint**. 3. **Connect Your Repository**: - Select your GitHub repository (`speech-model`). - Render will detect `render.yaml` automatically. 4. **Deploy**: - Click **Apply**. Render will build the Docker container and deploy the web service. - Once the build completes (approx. 2 to 3 minutes), your live URL (e.g. `https://anvaya-speech-diagnostics.onrender.com`) will be active. --- ## Method 2: Manual Web Service Setup If you prefer to configure the service manually on Render: 1. In Render Dashboard, click **New +** $\to$ **Web Service**. 2. Select **Build and deploy from a Git repository** $\to$ Connect your repository. 3. Configure the service settings: - **Name**: `anvaya-speech-diagnostics` - **Region**: Oregon (or your preferred region) - **Branch**: `main` - **Runtime**: **Docker** - **Dockerfile Path**: `Dockerfile` - **Instance Type**: **Starter** (Recommended: 1 GB RAM, 1 vCPU) or **Free** 4. Set Environment Variables under **Advanced**: | Variable | Value | | :--- | :--- | | `STREAMLIT_SERVER_HEADLESS` | `true` | | `STREAMLIT_SERVER_ENABLE_CORS` | `false` | | `STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION` | `false` | | `STREAMLIT_BROWSER_GATHER_USAGE_STATS` | `false` | 5. Click **Create Web Service**. --- ## Health Check and Live Diagnostics - **Health Check Endpoint**: `/_stcore/health` - **Microphone Permissions**: Web Audio recording works natively over HTTPS (provided automatically by Render's free SSL certificates on `*.onrender.com`).