A modular Gradio application that loads a YouTube transcript, summarizes it, and answers questions using retrieval-augmented generation.
youtube_app/config.pyloads and validates environment settings.youtube_app/transcript.pyparses YouTube URLs and normalizes captions.youtube_app/providers.pycontains OpenRouter LLM and embedding adapters.youtube_app/rag.pychunks transcripts and performs direct FAISS retrieval.youtube_app/chains.pyowns prompts and LCEL chains.youtube_app/service.pycoordinates the application use cases and caches indexes per video.youtube_app/ui.pycontains only the Gradio presentation layer.main.pyis the deployment entry point.
Use Python 3.11 or newer. From this directory:
python -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[dev]"
cp .env.example .envSet OPENROUTER_API_KEY in .env, then run:
python main.pyOpen http://127.0.0.1:7860 in a browser. The free router is the default chat model; set OPENROUTER_MODEL to another OpenRouter model when needed.
pytestThe tests use fake embeddings and do not call YouTube or OpenRouter.
docker build -t youtube-summarizer .
docker run --rm -p 7860:7860 --env-file .env youtube-summarizer.env is ignored and must never be committed. If an API key has ever been shared or committed, revoke it and create a replacement before publishing the repository.