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.30.tar.gz
(8.0 kB
view hashes)
Built Distribution
picachain-0.1.30-py3-none-any.whl
(11.1 kB
view hashes)
Close
Hashes for picachain-0.1.30-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e39997f18214f8499b373101d2b8580d251c8d6cb3c418f479079b295ceabbe |
|
MD5 | 88480ccaca49cc0adf2bf0af8ed11086 |
|
BLAKE2b-256 | 23e7f10b622a92fdfb58321f2a524d4c99c1b5202b3464aff855dbbc1b4e67f7 |