Python Flask backend service for AI-powered audio processing deployed on Google Cloud Run.
- Stem Separation: Separate audio into vocals, drums, bass, and other using Spleeter
- Audio Mastering: AI-powered mastering and effects
- Async Processing: Cloud Tasks queue for long-running jobs
- Cloud Storage: Direct GCS upload/download with signed URLs
- Firebase Auth: Secure authentication with social providers
- Runtime: Python 3.11
- Framework: Flask 3.0
- AI/ML: Spleeter, Demucs, Librosa, Pedalboard
- Cloud: GCP Cloud Run, Cloud Storage, Cloud Tasks, Firestore
- Auth: Firebase Admin SDK
- Python 3.11+
- FFmpeg
- GCP account with project setup
- Firebase project
- Install dependencies:
pip install -r requirements.txt- Set environment variables:
cp .env.example .env
# Edit .env with your GCP/Firebase credentials- Run development server:
export FLASK_APP=app
export FLASK_ENV=development
flask run --port=8080GET /health
POST /api/upload
Authorization: Bearer <firebase-token>
Body: { "filename": "audio.mp3", "contentType": "audio/mpeg" }
Response: { "uploadUrl": "...", "fileId": "...", "gcsPath": "..." }
POST /api/process
Authorization: Bearer <firebase-token>
Body: { "fileId": "...", "jobType": "stem-separation" | "mastering" }
Response: { "jobId": "...", "status": "pending" }
GET /api/jobs/<job_id>
Authorization: Bearer <firebase-token>
Response: { "id": "...", "status": "...", "progress": 0-100, "outputUrls": {...} }
gcloud builds submit --config cloudbuild.yamlGCP_PROJECT_ID: Your GCP project IDGCS_UPLOADS_BUCKET: Upload bucket nameGCS_PROCESSED_BUCKET: Processed files bucketCLOUD_TASKS_QUEUE: Queue nameCLOUD_TASKS_LOCATION: Queue regionSERVICE_URL: Cloud Run service URL
Client → Cloud Run (Flask) → Cloud Tasks → Worker (Flask)
↓ ↓
Firestore (jobs) Cloud Storage
MIT