Simple image search engine package.
Project description
📌 Install Picachain
Create a local datastore with ChromaDB for image search.
With pip
:
pip install picachain
🚀 Getting Started
With less than 10 lines of code, create an image search engine with the help of picachain and chromadb.
from PIL import Image
import matplotlib.pyplot as plt
# import from picachain
from picachain.datastore import ChromaStore
from picachain.embedding import ClipEmbedding
from picachain.retriever import ImageRetriever
from picachain.search import ImageSearch
img = Image.open("image-path") # query image
images = [Image.open(os.path.join("images-path", image)) for image in os.listdir("images-path")] # image collection
# initiate embedding, datastore and retriever
embedding = ClipEmbedding()
datastore = ChromaStore("test-collection")
retriever = ImageRetriever(datastore, embedding, images)
image_search = ImageSearch(retriever=retriever, embedding=embedding, query_img=img)
result = image_search.search_relevant_images(top_k=3) # get top 3 relevant images
for img, score in result: # [(img, score), (img, score)]
plt.imshow(img)
plt.show()
It is under continuous development so currently supports only ChromaDB. We are working on integrating all popular vector databases such as Pinecone, Weaviate, etc.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
picachain-0.1.31.tar.gz
(8.0 kB
view details)
Built Distribution
File details
Details for the file picachain-0.1.31.tar.gz
.
File metadata
- Download URL: picachain-0.1.31.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.8.10 Linux/5.15.0-101-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0d016eefd54afd30428e2ee8dc935ab80be46cc2d1a159f448bcee3c092ebac |
|
MD5 | 20a1e50d84b933f5d7f41df0f13f6f95 |
|
BLAKE2b-256 | c472dc56c3f1f69bf5ab1e59fe89f060f26225309547c9d75cef31c07950c121 |
File details
Details for the file picachain-0.1.31-py3-none-any.whl
.
File metadata
- Download URL: picachain-0.1.31-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.8.10 Linux/5.15.0-101-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b3f06946730dcb26e286b9f7573ba779191bae233189efad50e71fb15a1cc69 |
|
MD5 | d7a51dc5d6038359f9e84678760fb6d6 |
|
BLAKE2b-256 | 41923966f394d8e50d8c8a2190c6dd3f4f0bae29b25868b1a47b0a9374e8cdde |