Spaces:
Runtime error
Runtime error
metadata
title: YouTube Translator & Speaker
emoji: π€
colorFrom: indigo
colorTo: blue
sdk: docker
app_port: 7860
pinned: false
YouTube Translator & Speaker (Hugging Face β Docker Space)
A fully automated YouTube translation and speech tool that:
β
Extracts transcripts using YouTube captions
β
Uses OpenAI Whisper if captions are missing (requires OPENAI_API_KEY)
β
Translates into a selected language using OpenAI GPT
β
Can optionally generate speech using edge-tts (no key required)
π Deploy on Hugging Face (Docker)
- Create a new Space β Docker
- Upload these files:
Dockerfile,app.py,requirements.txt,README.md - Go to Settings β Repository secrets β Add new secret
- Name:
OPENAI_API_KEY - Value:
sk-xxxxxxxxxxxxxxxxxxxxx
- Name:
- Click Restart/Build Space
βΆοΈ Use the App
- Paste a YouTube URL or 11-char Video ID
- Select target language (
en,es,hi,ha, etc.) - (Optional) Keep Generate Speech enabled
- Click Submit β read translated text / play MP3
β οΈ Common Issues
| Issue | Cause | Solution |
|---|---|---|
| Invalid video | Bad URL/ID | Use full URL or exact 11-char ID |
| No captions & no key | Video lacks subtitles | Add OPENAI_API_KEY for Whisper fallback |
| Translation failed | Key missing/expired | Re-add correct key in Secrets |
| TTS failed | Network hiccup | Retry or uncheck speech |
π» Local Run (optional)
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
export OPENAI_API_KEY=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
python app.py