π₯ YouTube Transcript Q&A
A Streamlit-powered web app that lets you interactively query and summarize YouTube videos using their transcripts. It leverages LangChain, Google Gemini (via LangChain's ChatGoogleGenerativeAI), FAISS for vector search, and YouTube's Transcript API.
π Features β Ask questions about any YouTube video with English captions
π§ RAG-based retrieval using LangChain & FAISS
π‘ Quick actions like "Summarize Video" and "Key Points"
π Chat history with expand/collapse UI
π¨ Beautifully styled UI using custom Streamlit theming
π Secure environment variable handling with .env
π¦ Tech Stack Feature Tech Used Frontend Streamlit Backend LLM Google Gemini via LangChain Embeddings GoogleGenerativeAIEmbeddings RAG Implementation FAISS + LangChain Runnable Pipelines Transcript API youtube-transcript-api Env Management python-dotenv
π οΈ Setup Instructions
- Clone the Repository bash Copy Edit git clone https://github.com/your-username/youtube-transcript-qa.git
cd youtube-transcript-qa
- Install Dependencies bash Copy Edit pip install -r requirements.txt Requirements include:
streamlit
langchain
langchain-google-genai
langchain-community
youtube-transcript-api
python-dotenv
- Set Environment Variables Create a .env file in the root directory:
ini Copy Edit GOOGLE_API_KEY=your_google_generative_ai_key 4. Run the App bash Copy Edit streamlit run app.py β¨ How It Works π 1. Input a YouTube Video Paste a YouTube link or Video ID into the sidebar.
π 2. Transcript Extraction Uses youtube-transcript-api to fetch English subtitles, if available.
π 3. Chunking + Embedding + Indexing The transcript is split into semantic chunks using LangChain's RecursiveCharacterTextSplitter, embedded using Google Embeddings, and indexed using FAISS.
π§ 4. Retrieval-Augmented Generation (RAG) A custom LangChain RAG pipeline is built using RunnableParallel, PromptTemplate, and StrOutputParser to retrieve relevant transcript sections and generate LLM-powered answers.
π¬ 5. Ask & Get Answers Users can interactively ask questions, receive answers, and browse chat history. Quick prompts like summary and key points are also provided.
πΈ UI Highlights π― Clear sidebar instructions
π Video info block with link and status
π¬ Expandable Q&A sections
β‘ Streamlined quick action buttons
π± Responsive layout and theming
π§ͺ Sample Questions "Can you summarize the video?"
"What are the key points discussed?"
"What does the speaker say about [topic]?"
"Who is the target audience for this video?"
π§Ή To-Do & Improvements Add multilingual transcript support
Add memory-enabled chat sessions
Deploy on Streamlit Cloud or Hugging Face Spaces
Add error tracking/logging system