Skip to content

myriel-io/qdrant-image-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Text-to-Image Matcher

A Streamlit application that uses Qdrant vector database and CLIP model for text-to-image matching.

Demo

Demo of the Text-to-Image Matcher

Features

  • Upload multiple images through a simple web interface
  • Search images using natural language queries
  • Real-time similarity matching using CLIP embeddings
  • Persistent storage using local Qdrant instance
  • Visual results display with similarity scores

Prerequisites

  • Python 3.8+
  • Qdrant running locally on port 6333
  • Docker (optional, for running Qdrant)

Installation

  1. Clone this repository

  2. Install dependencies:

pip install -r requirements.txt
  1. Start Qdrant (if not already running):
# Using Docker
docker run -p 6333:6333 qdrant/qdrant

Usage

  1. Start the Streamlit app:
streamlit run app.py
  1. Open your browser and navigate to the URL shown in the terminal (typically http://localhost:8501)

  2. Upload images using the sidebar uploader

  3. Enter text queries in the search box to find similar images

Project Structure

.
├── README.md
├── requirements.txt
└── app.py

How It Works

  1. Image Processing:

    • Images are uploaded through the Streamlit interface
    • CLIP model encodes images into vector embeddings
    • Vectors are stored in Qdrant along with the image data
  2. Text Search:

    • User enters a text query
    • CLIP model converts text to vector embedding
    • Qdrant performs similarity search
    • Most similar images are displayed with scores

Technical Details

  • Uses CLIP ViT-B-32 model for encoding both images and text
  • Vector dimension: 512
  • Distance metric: Cosine similarity
  • Images are stored as base64 encoded strings in Qdrant payloads

Configuration

The app connects to Qdrant using these default settings:

  • Host: localhost
  • Port: 6333

To modify these settings, update the init_qdrant() function in app.py.

Limitations

  • Currently only supports JPG, JPEG, and PNG image formats
  • In-memory image processing may be limited by available RAM
  • Search results are limited to top 5 matches

Contributing

Feel free to open issues or submit pull requests for any improvements.

License

[Your chosen license]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages