This application demonstrates how to use ChromaDB to create a multimodal search system. It allows you to find similar images based on a query image or a text query.
This guide prioritizes using Docker as it's the simplest and most reliable way to run the application, avoiding any local Python environment issues.
This workflow uses Docker volumes to store your vector database (my_vectordb) on your host machine. This ensures your data persists even after the container stops.
git clone git@github.com:trnqeu/chromadb-multimodal.git
cd chromadb-multimodaldocker build -t chromadb-multimodal .You need a local directory to store the persistent database and a directory containing the images you want to upload.
# 1. Create a directory for the persistent database
mkdir ./my_local_vectordb
# 2. Make note of your image directory's absolute path
# For this guide, we'll use /path/to/your/images as a placeholder.
# Example: /home/user/Pictures/my-datasetRun the setup scripts inside the container, mounting your local directories as volumes.
a. Create the Collection:
This command runs the create_collection.py script, which will create the multimodal_collection inside your ./data folder.
docker run --rm \
-v ./my_local_vectordb:/app/my_vectordb \
chromadb-multimodal \
python create_collection.pyb. Upload Your Images:
This command runs the upload_images.py script. It mounts your local database (so it can add to it) and your local images (so it can read them).
Note: Replace /path/to/your/images with the absolute path to your images.
docker run --rm \
-v ./my_local_vectordb:/app/my_vectordb \
-v ./data:/data \
chromadb-multimodal \
python upload_images.py /dataFinally, run the main Gradio application. It will connect to the persistent database you just populated.
docker run --rm -p 7860:7860 \
-v ./my_local_vectordb:/app/my_vectordb \
-v ./data:/data \
chromadb-multimodalYou can now access the web interface at http://localhost:7860.
To delete all data and start over, run the delete_collection.py script using the same volume mount:
docker run --rm \
-v ./my_local_vectordb:/app/my_vectordb \
chromadb-multimodal \
python delete_collection.pyIf you prefer to run the application locally without Docker, you can use pipenv.
- Python 3.12+
pipenv(Recommended installation:pipx install pipenv)
pipenv installa. Create the Collection:
pipenv run python create_collection.pyThis will create a my_vectordb directory in your project folder.
b. Upload Images:
pipenv run python upload_images.py /path/to/your/imagesc. Run the App:
pipenv run python app.pyThis will start the Gradio web interface at http://127.0.0.1:7860.