# π Darija Caption Studio
**Hybrid Whisper + AI Moroccan Darija caption generator**
Upload any audio or video file to get AI-generated Moroccan Darija captions with timestamps, improved by GPT-4o-mini (or Gemini 2.0 Flash), with optional translation to English, French, or Arabic and export to SRT/VTT/TXT/JSON.
---
## ποΈ Architecture
```
Audio/Video Upload
β
Flask Server
β
ffmpeg (β /tmp audio extraction)
β
OpenAI Whisper-1 (raw Darija timestamps)
β
GPT-4o-mini OR Gemini 2.0 Flash
(Darija language refinement)
β
JSON: { segments: [{id, start, end, text, whisper_text, refine_engine}] }
β
Frontend editor + translation + export
```
---
## π Deploy to Vercel (Recommended)
### Prerequisites
- Vercel account (free, no credit card for hobby tier)
- OpenAI API key
- Optional: Gemini API key
### Step 1 β Push to GitHub
```bash
git clone
github.com
cd darija-caption-studio
git init
git add .
git commit -m "Darija Caption Studio v2"
git push -u origin main
```
### Step 2 β Deploy on Vercel
```bash
npm i -g vercel
vercel --prod
```
Or via the dashboard: vercel.com β Import β connect GitHub repo β Add Environment Variables β Deploy.
### Step 3 β Set Environment Variables
In Vercel dashboard β Settings β Environment Variables:
| Variable | Required | Description |
|---|---|---|
| `OPENAI_API_KEY` | β
| Your OpenAI API key |
| `OPENAI_BASE_URL` | β | Proxy base URL (optional) |
| `GEMINI_API_KEY` | β | Gemini API key (GPT fallback used if omitted) |
| `CF_AIG_TOKEN` | β | Proxy auth token (optional) |
### Step 4 β Done! π
Your app will be live at: `
darija-caption-studio.verceβ¦`
---
## π³ Deploy to Fly.io
```bash
# Install flyctl
curl -fsSL
fly.io | sh
export PATH="$HOME/.fly/bin:$PATH"
# Login
flyctl auth login
# Set secrets
flyctl secrets set OPENAI_API_KEY___="sk-..." --app darija-caption-studio
flyctl secrets set GEMINI_API_KEY___="..." --app darija-caption-studio
# Deploy
flyc β¦