Skip to main content

Build quick LLM pipelines for image specific tasks.

Project description

⚡️ Build quick LLM pipelines for all your image specific tasks

Python

PyPi license PyPI version fury.io Twitter

Picachain is a framework for building complex non language pipelines for your LLM application. Build pipelines for your images, charts and graphs, parse, extract and generate using opensource models with ease, thanks to support for huggingface and diffusion libraries.

🌉 Things you can build with Picachain

  • Image Search Engines: Build quick search engines for your images using ChromaDB and Pinecone for vector storage and retrieval.
  • Image Generation: Generate images with ease, thanks to support of Stable Diffusion, SDXL and SDXLturbo.
  • Chart Parsing: Parse chart/graph from images and extract meaningful data and build a question-answering system on top of this using an LLM.

📌 Install Picachain

pip install picachain

🥇 Example Usage

Build a quick image search engine

Use ChromaDB or Pinecone for storage with CLIP embeddings. Check out a demo Open In Colab

from PIL import Image
import matplotlib.pyplot as plt

# import from picachain
from picachain.chains.image.search import ImageSearchChain
from picachain.datastore import ChromaStore, PineconeStore
from picachain.embedding import ClipEmbedding
from picachain.retriever import ImageRetriever
img = Image.open("image.png") # query image
images = [...] # list of images
# initiate embedding, datastore and retriever
embedding = ClipEmbedding()
datastore = ChromaStore("test-collection")
retriever = ImageRetriever(datastore, embedding, images)
img_chain = ImageSearchChain.from_image(retriever, embedding, img)
result = img_chain.similar_images(top_k=3)

for img, score in result: # [(img, score), (img, score)]
    plt.imshow(img)
    plt.show()

Build Chart Conversation Chain

from dotenv import load_dotenv
from picachain.chains.unstructured.charts import ChartConversationChain
from picachain.models.openai.openai import OpenAI_Model
load_dotenv()
chart_conv_chain = ChartConversationChain(
    chart="/home/home/dev/picachain/data/chart1.png", llm=OpenAI_Model()
)
response = chart_conv_chain.run(query="What do I eat?")
print(response)

💡 Contributing

As an open-source project, we are open to all kinds of contribution, be it through code, documentation, issues, bugs, or even feature suggestions.

Feel free to check out Contribution guide for more details.

🔧 Dependencies

We use poetry as the package manager. Make sure to refer to pyproject.toml for more details on dependencies.

cd picachain
pip install poetry
poetry install 

Project details


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.37.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

picachain-0.1.37-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file picachain-0.1.37.tar.gz.

File metadata

  • Download URL: picachain-0.1.37.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.8.10 Linux/5.15.0-102-generic

File hashes

Hashes for picachain-0.1.37.tar.gz
Algorithm Hash digest
SHA256 282df4db19ce7ac13e57e6143d0de5407c4d0e575b2e325f057d17799d3a2424
MD5 ca2232837c5c147d3a42e1d0f1290a2b
BLAKE2b-256 fd6e9b7c811099de605b7f4b33a699a0e16b926b4bce60bde8bb09d9db682009

See more details on using hashes here.

File details

Details for the file picachain-0.1.37-py3-none-any.whl.

File metadata

  • Download URL: picachain-0.1.37-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.8.10 Linux/5.15.0-102-generic

File hashes

Hashes for picachain-0.1.37-py3-none-any.whl
Algorithm Hash digest
SHA256 63bea92563dc9e058ebabdc93f2d69b5d7942ca152f4223d743ccecc6f6acf91
MD5 c31155db37a806a4ab88119d66a8dfc6
BLAKE2b-256 6cc99ea810c8d8ca61a5da4346a5fa4e9f986cd2bc3a081ec9b70d02521f391b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page