DARKWICK commited on
Commit
7d0739b
Β·
verified Β·
1 Parent(s): 2b58518

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +47 -20
README.md CHANGED
@@ -1,30 +1,57 @@
 
 
 
 
 
 
 
 
 
 
1
  # YouTube Translator & Speaker (Hugging Face β€” Docker Space)
2
 
3
- A fully automated application that:
4
- βœ… Extracts video transcripts using YouTube captions
5
- βœ… Falls back to OpenAI Whisper transcription if no captions exist (requires `OPENAI_API_KEY`)
6
- βœ… Translates text into your selected language using OpenAI GPT
7
- βœ… Optionally converts translated text into speech using `edge-tts` (no key required)
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  ---
10
 
11
- ## πŸš€ How to Deploy on Hugging Face (Docker)
 
 
 
 
12
 
13
- ### 1️⃣ Create a New Space
14
- - Click: **New Space β†’ Docker**
15
- - Name example: `youtube-translator`
16
- - Choose **Public** or **Private**
17
- - Click **Create Space**
18
 
19
- ### 2️⃣ Upload the following files:
20
- βœ… `app.py`
21
- βœ… `requirements.txt`
22
- βœ… `Dockerfile`
23
- βœ… `README.md` (this file)
 
 
 
24
 
25
  ---
26
 
27
- ## πŸ”‘ Add Your OpenAI API Key (Required)
28
- 1. Go to your Space
29
- 2. Click **Settings β†’ Repository secrets**
30
- 3. Click **Add ne**
 
 
 
 
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