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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: picachain-0.1.36.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.36.tar.gz
Algorithm Hash digest
SHA256 b3765a68e2f8627a9165d887a69451d66ec650eaf457a17a2ae062189fa7fe98
MD5 0110366f15f77a31dc3bddb821f5c162
BLAKE2b-256 4eb7ba225bb64d5cc6f4fa2b47ed6a5fd43fddd191afa471e5a48fe45c19d779

See more details on using hashes here.

File details

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

File metadata

  • Download URL: picachain-0.1.36-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.36-py3-none-any.whl
Algorithm Hash digest
SHA256 48d1f57c69c08e54bbc6609d1b8d3bfc5ad6be21ecb4aadae1f384b183ae5357
MD5 c81e47ba0782c69b3b8ba5fc9f1c5462
BLAKE2b-256 4c7748ab60dbe5dbe353ae4b60fa129b80aaba47f2042b0709a19de112bfb4a4

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