This project consists of two main components: a CLIP embedding service and a Next.js image search application. Before running these services, you need to prepare the dataset using the Jupyter notebook.
- Docker and Docker Compose
- Python 3.8+ (for dataset preparation)
- Jupyter Notebook or VSCode with Jupyter extension
Create a .env
file in the root directory with the following content:
Note: For CLIP_MODEL_ID
, use any model from Hugging Face that supports 768-dimensional embeddings.
PINECONE_API_KEY=your_pinecone_api_key
PINECONE_INDEX_NAME=your_pinecone_index_name
CLIP_MODEL_ID=your_clip_model_id
Before running the main application, you need to prepare the dataset:
- Follow the instructions in the
prepare-dataset-notebook/README.md
file to set up and run theimage-prepare.ipynb
notebook. - This notebook will download images, create embeddings, and store them in Pinecone.
- Build the Docker images:
docker-compose build
- Start the services:
docker-compose up
- A stateless service that converts text or images into embeddings using the CLIP model.
- Built with the CLIP model specified in the
.env
file. - Runs on port 8000.
- A web application that allows users to search for images using text queries.
- Performs embedding search for top-K values on the Pinecone database.
- Runs on port 3000.
- Ensure both services are running (
docker-compose up
). - Access the Next.js application at
http://localhost:3000
. - Enter a text query to search for similar images in the Pinecone database.
- The CLIP Fast API service is defined in the
clipfastapi
service in the Docker Compose file. - The Next.js Image Search application is defined in the
clipimagesearch
service.
- If you encounter issues, ensure all environment variables are correctly set in the
.env
file. - For CLIP model issues, verify that you're using a compatible model from Hugging Face.
For any persistent problems, please open an issue in the repository.