Obese_Kitty / README.md
DARKWICK's picture
Update README.md
7d0739b verified
---
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)
1) Create a new Space β†’ **Docker**
2) Upload these files: `Dockerfile`, `app.py`, `requirements.txt`, `README.md`
3) Go to **Settings β†’ Repository secrets β†’ Add new secret**
- Name: `OPENAI_API_KEY`
- Value: `sk-xxxxxxxxxxxxxxxxxxxxx`
4) Click **Restart/Build Space**
---
## ▢️ Use the App
1. Paste a **YouTube URL** or **11-char Video ID**
2. Select target language (`en`, `es`, `hi`, `ha`, etc.)
3. (Optional) Keep **Generate Speech** enabled
4. 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)
```bash
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
export OPENAI_API_KEY=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
python app.py