Spaces:
Runtime error
Runtime error
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,30 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# YouTube Translator & Speaker (Hugging Face β Docker Space)
|
| 2 |
|
| 3 |
-
A fully automated
|
| 4 |
-
β
Extracts
|
| 5 |
-
β
|
| 6 |
-
β
Translates
|
| 7 |
-
β
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
---
|
| 10 |
|
| 11 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
|
| 14 |
-
- Click: **New Space β Docker**
|
| 15 |
-
- Name example: `youtube-translator`
|
| 16 |
-
- Choose **Public** or **Private**
|
| 17 |
-
- Click **Create Space**
|
| 18 |
|
| 19 |
-
##
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
---
|
| 26 |
|
| 27 |
-
##
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: YouTube Translator & Speaker
|
| 3 |
+
emoji: π€
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: blue
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
+
pinned: false
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
# YouTube Translator & Speaker (Hugging Face β Docker Space)
|
| 12 |
|
| 13 |
+
A fully automated YouTube translation and speech tool that:
|
| 14 |
+
β
Extracts transcripts using YouTube captions
|
| 15 |
+
β
Uses OpenAI Whisper if captions are missing (requires `OPENAI_API_KEY`)
|
| 16 |
+
β
Translates into a selected language using OpenAI GPT
|
| 17 |
+
β
Can optionally generate speech using `edge-tts` (no key required)
|
| 18 |
+
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
## π Deploy on Hugging Face (Docker)
|
| 22 |
+
|
| 23 |
+
1) Create a new Space β **Docker**
|
| 24 |
+
2) Upload these files: `Dockerfile`, `app.py`, `requirements.txt`, `README.md`
|
| 25 |
+
3) Go to **Settings β Repository secrets β Add new secret**
|
| 26 |
+
- Name: `OPENAI_API_KEY`
|
| 27 |
+
- Value: `sk-xxxxxxxxxxxxxxxxxxxxx`
|
| 28 |
+
4) Click **Restart/Build Space**
|
| 29 |
|
| 30 |
---
|
| 31 |
|
| 32 |
+
## βΆοΈ Use the App
|
| 33 |
+
1. Paste a **YouTube URL** or **11-char Video ID**
|
| 34 |
+
2. Select target language (`en`, `es`, `hi`, `ha`, etc.)
|
| 35 |
+
3. (Optional) Keep **Generate Speech** enabled
|
| 36 |
+
4. Click **Submit** β read translated text / play MP3
|
| 37 |
|
| 38 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
## β οΈ Common Issues
|
| 41 |
+
|
| 42 |
+
| Issue | Cause | Solution |
|
| 43 |
+
|------|------|---------|
|
| 44 |
+
| Invalid video | Bad URL/ID | Use full URL or exact 11-char ID |
|
| 45 |
+
| No captions & no key | Video lacks subtitles | Add `OPENAI_API_KEY` for Whisper fallback |
|
| 46 |
+
| Translation failed | Key missing/expired | Re-add correct key in Secrets |
|
| 47 |
+
| TTS failed | Network hiccup | Retry or uncheck speech |
|
| 48 |
|
| 49 |
---
|
| 50 |
|
| 51 |
+
## π» Local Run (optional)
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
python -m venv .venv && source .venv/bin/activate
|
| 55 |
+
pip install -r requirements.txt
|
| 56 |
+
export OPENAI_API_KEY=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
|
| 57 |
+
python app.py
|