01ad42f6a18c63801d637231ea7f14ef8b59d2c7
Backend (Audio -> Whisper -> Supabase)
This backend:
- accepts an audio file,
- transcribes it with OpenAI Whisper (
whisper-1), - stores transcript text in Supabase
posts.transcribed_text, - links categories in
post_categories.
Install
pip install -r requirements.txt
Environment variables
OPENAI_API_KEYSUPABASE_URLSUPABASE_SERVICE_ROLE_KEY(use service-role key on backend only)UPLOAD_DIR(default:uploads)PORT(default:5000)
Run
python speech_to_text.py
Endpoints
GET /healthGET /health/dbPOST /upload-audio
Upload example
curl -X POST http://localhost:5000/upload-audio \
-F "file=@sample.mp3" \
-F "user_id=1" \
-F "title=My oral history" \
-F "category_ids=1,4" \
-F "is_private=false"
Required tables in Supabase
Your Supabase Postgres project should already contain:
userspostspost_categoriescategories
Note: user_id must exist in users before upload.
Languages
JavaScript
61.8%
Python
37.1%
Dockerfile
0.8%
HTML
0.3%