This project implements a Streamlit web application that analyzes YouTube videos using multimodal AI models. The app extracts video frames, audio, and text data from a given YouTube video and allows you to perform queries over the multimodal data using a Local Qdrant vector store and LLaMA-based models.
- YouTube Video Analysis: Download and process YouTube videos, extracting images, audio, and transcribed text.
- Multimodal AI Queries: Perform multimodal queries across text and images using
OllamaMultiModalLLM. - Vector Store Indexing: Store and retrieve multimodal data using a local Qdrant vector store for efficient querying.
- Streamlit Interface: Simple and interactive web interface for video URL input, queries, and results display.
-
Clone this repository to your local machine:
git clone https://github.com/yourusername/youtube-video-analyzer.git cd youtube-video-analyzer -
Install the required dependencies:
pip install -r requirements.txt
-
Set up Qdrant, a local vector store for storing embeddings. You can either use the server version or stick with the embedded store.
-
Install Streamlit for the web-based interface:
pip install streamlit
-
(Optional) Download the models used for embeddings and multimodal AI queries if not installed automatically.
-
To run the app, simply execute:
streamlit run app.py
-
Enter the YouTube video URL in the input field on the left sidebar.
-
The app will:
- Download the video.
- Extract frames and save them as images.
- Extract audio and convert it to text using Whisper.
- Store all data in a local Qdrant vector store.
-
Once indexed, enter your query to search across the text and image embeddings for relevant results.
YouTube Video Download & Processing: Download video content usingpytube, then process it to extract frames and audio.Multimodal Embeddings: Use HuggingFace and CLIP models to create embeddings for both the text and image data.Qdrant Vector Store: A local vector store is used to store and retrieve embeddings efficiently.LLaMA-based Multimodal AI Model: LLaMA is used for generating responses to queries over the indexed data.Streamlit Interface: Interactive web app to accept YouTube URLs, enter queries, and view results.
- Download YouTube Video: The video is downloaded using
pytube. - Extract Frames and Audio: Frames are saved as PNG files, and the audio is extracted and transcribed using
Whisper. - Indexing: Both text and image data are indexed and stored in Qdrant.
- Querying: Users can submit text-based queries to retrieve relevant data from the indexed video.
- Caching: Index creation is cached using
st.cache_resourceto avoid reprocessing the same video multiple times. - Resetting: The Qdrant store and cached resources can be reset by:
shutil.rmtree("qdrant_mm_db") # Deletes the Qdrant database st.session_state.clear() # Clears the session state and cache
Contributions are welcome! Feel free to open an issue or submit a pull request for any improvements, bug fixes, or feature requests.
- Fork this repository.
- Create a new branch for your feature.
- Make your changes and push to your branch.
- Submit a pull request and describe your changes.
This project is licensed under the MIT License. See the LICENSE file for details.