This system is designed to facilitate semantic search for car images based on user queries. It utilizes the CLIP (Contrastive Language-Image Pretraining) model to generate embeddings for both text and images, enabling efficient similarity search.
- Description: Contains classes responsible for generating embeddings for images and text using the CLIPProcessor.
- Functionality: Utilizes the CLIPProcessor to encode images and text into embeddings.
- Description: A script responsible for scraping images of cars from DuckDuckGo search engine and storing them in the images directory.
- Functionality: Automates the process of fetching images from DuckDuckGo and saving them locally for further processing.
- Description: Creates embeddings for the scraped images and stores them in the image collection.
- Functionality: Utilizes Embed.py to generate embeddings for images scraped by Scrape_images.py and stores them for later retrieval.
- Description: Serves as the main API endpoint.
- Functionality: Accepts user queries, performs vector search using the generated embeddings, and returns up to 3 relevant results from the image collection.
- Description: A simple frontend interface for users to input queries and view semantic search results.
- Functionality: Accepts user queries, sends them to the backend API (Main.py), and displays the retrieved search results in a user-friendly manner.
In a location where you want to place this repo, use the following commands:
git clone https://github.com/JS12540/Text2ImageSearch.git
-
Navigate to the backend directory:
cd backend
-
Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate
-
Install the required Python packages:
pip install -r requirements.txt
-
Create necessary directories:
mkdir data mkdir images
-
Deactivate the virtual environment:
deactivate
-
Navigate to the frontend directory:
cd frontend
-
Ensure Node.js version 21.5.0 is being used:
nvm use 21.5.0
-
Install dependencies:
npm install
-
Navigate to the backend directory:
cd backend
-
Activate the virtual environment:
source venv/bin/activate
-
Run the FastAPI server using Uvicorn:
uvicorn main:app --reload
-
To run the vectorize.py script to store embeddings in qdrant:
python vectorize.py
-
Deactivate the virtual environment:
deactivate
-
Navigate to the frontend directory:
cd frontend
-
Start the frontend server:
npm start