Skip to content

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

AI-Powered YouTube Summarizer

A Python application that fetches a YouTube video's transcript, splits it into meaningful chunks, stores the content in a vector database, and uses IBM Watsonx to generate a summary and answer questions about the video.

This project combines:

  • YouTube transcript extraction
  • transcript preprocessing and chunking
  • FAISS-based semantic retrieval
  • IBM Watsonx LLM summarization
  • Q&A generation from video content
  • a Gradio interface for easy interaction

Features

  • Extract transcript from a public YouTube URL
  • Filter and normalize transcript text
  • Chunk transcript content for efficient retrieval
  • Create embeddings with IBM Watsonx
  • Search relevant sections using FAISS similarity search
  • Generate a concise video summary
  • Answer user questions based on the transcript context
  • Launch a simple web UI using Gradio

Project Structure

  • ytbot.py - main app containing transcript extraction, embedding, RAG pipeline, and Gradio interface
  • README.MD - project documentation

Requirements

  • Python 3.11+
  • pip
  • IBM Cloud / IBM watsonx access
  • Access to public YouTube transcripts

Setup

  1. Clone the repository
git clone https://github.com/AlanMelendez/AI-Powered-YouTube-Summarizer.git
cd AI-Powered-YouTube-Summarizer
  1. Create and activate a virtual environment

On macOS/Linux:

python3 -m venv my_env
source my_env/bin/activate

On Windows:

python -m venv my_env
my_env\Scripts\activate
  1. Install dependencies
pip install virtualenv
pip install youtube-transcript-api==1.2.1
pip install faiss-cpu==1.8.0
pip install langchain==0.2.6
pip install langchain-community==0.2.6
pip install ibm-watsonx-ai==1.0.10
pip install langchain_ibm==0.1.8
pip install gradio==4.44.1
python -m pip uninstall -y huggingface_hub
python -m pip install huggingface_hub==0.16.4
pip install --upgrade gradio fastapi starlette jinja2

Configuration

The application is configured in ytbot.py inside the setup_credentials() function and other model configuration blocks.

You will need to update these values for your environment:

  • IBM watsonx service URL
  • IBM project ID
  • model ID used for generation and embeddings

Example configuration pattern:

model_id = "ibm/granite-8b-code-instruct"
credentials = Credentials(url="https://us-south.ml.cloud.ibm.com")
project_id = "your-watsonx-project-id"

Make sure your IBM watsonx account has valid credentials and the required permissions before running the app.

Usage

Run the application:

python ytbot.py

This starts the Gradio interface in your browser. Then:

  1. Paste a YouTube video URL
  2. Click the relevant action to generate a summary or ask a question
  3. Review the output generated from the video's transcript

How It Works

The application follows this flow:

  1. Reads the YouTube URL
  2. Extracts the video ID using a regex
  3. Fetches the transcript using youtube-transcript-api
  4. Cleans and formats transcript data
  5. Splits the transcript into chunks
  6. Creates embeddings using IBM Watsonx
  7. Stores the chunks in a FAISS vector index
  8. Uses similarity search to find the most relevant content
  9. Sends the relevant transcript sections to an LLM for summary or Q&A generation

Example Transcript Format

[
  {
    "text": "We're no strangers to love.",
    "start": 0.0,
    "duration": 3.5
  },
  {
    "text": "You know the rules and so do I.",
    "start": 3.5,
    "duration": 4.0
  },
  {
    "text": "A full commitment's what I'm thinking of.",
    "start": 7.5,
    "duration": 4.0
  }
]

Notes

  • Some YouTube videos do not provide transcripts or may require manually generated captions.
  • The app focuses on public videos and transcript-based analysis.
  • The quality of the summary depends on the transcript quality and Watsonx model configuration.

Future Improvements

  • Add support for video metadata and chapter extraction
  • Improve prompt quality for faster, more accurate summaries
  • Add a requirement file for easier environment setup
  • Add error handling for unsupported or private videos
  • Add support for multiple languages and transcript selection

License

This project is intended for educational and personal use. Add a license if you plan to share or distribute it publicly.

Contributing

Pull requests and improvements are welcome. If you want to extend the app, consider improving:

  • transcript error handling
  • multi-language support
  • better citation and retrieval logic
  • UI usability
  • deployment setup

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages