This Python script allows you to download YouTube videos, process them using Google's Generative AI, and index the content for querying. It uses Pinecone for vector storage and retrieval using similarity search.
- Download YouTube videos
 - Get the video's contents using Google's GenerativeAI api (It's free!).
 - Index video content for semantic search
 - Query indexed content based on user input
 
Before you begin, ensure you have met the following requirements:
- Python 3.10+
 - pip (Python package manager)
 
- 
Clone this repository:
git clone https://github.com/Druvith/video-query.git cd video-query - 
Navigate to the backend directory:
cd backend - 
Create a virtual environment:
python -m venv venv - 
Activate the virtual environment:
- On macOS/Linux
 
source venv/bin/activate- On windows:
 
venv\Scripts\activate - 
Set up your environment variables: Create a
.envfile in the project root and add your API keys:GOOGLE_API_KEY=your_google_api_key OPENAI_API_KEY=your_openai_api_key PINECONE_API_KEY=your_pinecone_api_key - 
Install the required packages:
pip install -r requirements.txt - 
Run the backend server:
python app.py 
The backend server should now be running at http://127.0.0.1:5000.
- Node.js (includes npm)
 
- 
Navigate to the frontend directory:
cd frontend - 
Install the dependencies:
npm install
 - 
Start the frontend development server:
npm start
 
The frontend server should now be running at http://localhost:3000.
Follow the prompts to:
- Enter a YouTube video URL
 - Wait for the video to be processed and the responses from the model to be indexed
 - Enter queries to search the video segment
 - Use play clip if you want play or download the video segment
 
- The script downloads the specified YouTube video
 - Google's Generative AI processes the video and generates structured descriptions
 - The descriptions are converted into embeddings using openai's "text-embedding-3-small" model and stored in Pinecone's Index.
 - User queries are converted to embeddings and used to search (using cosine similarity) the Pinecone index
 - The most relevant video segments are returned based on the query
 
- Process Video: 
POST /process - Query Video: 
POST /query - Create Clip: 
POST /clip - Delete Index: 
POST /delete-index 
Contributions to this project are welcome. Please fork the repository and submit a pull request with your changes.
This project is licensed under the MIT License.
- Google Generative AI
 - OpenAI
 - Pinecone
 - yt-dlp
 - React
 - Axios