Update README.md
Browse files
README.md
CHANGED
|
@@ -1,74 +1,79 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
- **
|
| 21 |
-
- **
|
| 22 |
-
|
| 23 |
-
- **
|
| 24 |
-
|
| 25 |
-
---
|
| 26 |
-
|
| 27 |
-
##
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
```bash
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
**
|
| 65 |
-
|
| 66 |
-
- **
|
| 67 |
-
|
| 68 |
-
- **
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Video Transcript Chatbot
|
| 3 |
+
emoji: 🎥
|
| 4 |
+
colorFrom: yellow
|
| 5 |
+
colorTo: indigo
|
| 6 |
+
sdk: gradio
|
| 7 |
+
python_version: '3.10'
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Video Transcript Chatbot
|
| 11 |
+
|
| 12 |
+
A beginner-friendly Gradio app that turns any YouTube video into a conversational chatbot using LangChain and Hugging Face Inference API.
|
| 13 |
+
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
## Features
|
| 17 |
+
|
| 18 |
+
- **Dynamic Video Input**: Paste a full YouTube URL or raw video ID.
|
| 19 |
+
- **Embedding Model Selection**: Pick any HF embedding model (default: `sentence-transformers/all-MiniLM-L6-v2`).
|
| 20 |
+
- **LLM Model Selection**: Choose any HF text-generation model (default: `meta-llama/Llama-3.1-8B-Instruct`).
|
| 21 |
+
- **Secure Token Entry**: You must enter your own HF API token at runtime—no hard-coded defaults.
|
| 22 |
+
- **Conversational Memory**: Multi-turn chat history is preserved.
|
| 23 |
+
- **Retrieval-Augmented Generation**: Uses FAISS + transcript context to ground answers.
|
| 24 |
+
|
| 25 |
+
---
|
| 26 |
+
|
| 27 |
+
## Prerequisites
|
| 28 |
+
|
| 29 |
+
- **Python 3.8+**
|
| 30 |
+
- **Hugging Face API Token** with Inference access:
|
| 31 |
+
https://huggingface.co/settings/tokens
|
| 32 |
+
- **Git** (for cloning the repo)
|
| 33 |
+
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
## Installation
|
| 37 |
+
|
| 38 |
+
1. **Clone the repo**
|
| 39 |
+
```bash
|
| 40 |
+
git clone https://github.com/<your-username>/yt-rag-chatbot.git
|
| 41 |
+
cd yt-rag-chatbot
|
| 42 |
+
2. **(Optional) Create a virtual environment**
|
| 43 |
+
```bash
|
| 44 |
+
python -m venv venv
|
| 45 |
+
source venv/bin/activate # macOS/Linux
|
| 46 |
+
venv\Scripts\activate # Windows
|
| 47 |
+
3. **Install dependencies**
|
| 48 |
+
```bash
|
| 49 |
+
python -m venv venv
|
| 50 |
+
source venv/bin/activate # macOS/Linux
|
| 51 |
+
venv\Scripts\activate # Windows
|
| 52 |
+
|
| 53 |
+
**Usage**
|
| 54 |
+
1. **Start the app:**
|
| 55 |
+
```bash
|
| 56 |
+
python app.py
|
| 57 |
+
2. **Open** your browser at the local URL (e.g. http://127.0.0.1:7860)
|
| 58 |
+
3. **Use the UI:**
|
| 59 |
+
|
| 60 |
+
- **YouTube Video URL or ID:** Paste your link/ID.
|
| 61 |
+
|
| 62 |
+
- **Embedding Model:** Leave default or enter another HF embedding model.
|
| 63 |
+
|
| 64 |
+
- **LLM Model:** Enter your desired HF LLM repo.
|
| 65 |
+
|
| 66 |
+
- **Your HF API Token:** Paste your token (input hidden).
|
| 67 |
+
|
| 68 |
+
- Click **Initialize Chat** to load and index the transcript.
|
| 69 |
+
|
| 70 |
+
- Ask questions in the chat window to interact with the video content.
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
**Customization**
|
| 74 |
+
|
| 75 |
+
- **Default Models:** Edit the default values for embedding_model_input and llm_model_input in app.py.
|
| 76 |
+
|
| 77 |
+
- **Retrieval Size:** Change the k value in the retriever configuration:
|
| 78 |
+
```python
|
| 79 |
+
retriever = vector_store.as_retriever(search_kwargs={'k': 4})
|