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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: picachain-0.1.35.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.35.tar.gz
Algorithm Hash digest
SHA256 6637e0e0144b0d8f9cc2c9b318316c3290d1cc5349903fc6dfedc844dccafe29
MD5 3810b196390d266605cd96eb3dae6ca1
BLAKE2b-256 40e5991ae98d1d95dd2e27ea01ae54223fb1fc0bc98d945233a4a3e60776cadd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: picachain-0.1.35-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.35-py3-none-any.whl
Algorithm Hash digest
SHA256 e99a9d6d35a7086f6674e46bd3f21deae98362198828f99d6b9d9fcf9d5c2c28
MD5 9fb0b0187e758f3fb30a3747525b79c4
BLAKE2b-256 2243432e8c5c6954ddd555add3d51ffe7a0b2543c8818147213636930c1af89d

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