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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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