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
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
Metadata
Release files for picachain 0.1.37
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| picachain-0.1.37.tar.gz | 12.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| picachain-0.1.37-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.5 kB
Release files / picachain-0.1.37.tar.gz
| Download URL | picachain-0.1.37.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
282df4db19ce7ac13e57e6143d0de5407c4d0e575b2e325f057d17799d3a2424
|
|
BLAKE2b-256 checksum How to use checksums |
fd6e9b7c811099de605b7f4b33a699a0e16b926b4bce60bde8bb09d9db682009
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.8.10 Linux/5.15.0-102-generic
|
Release files / picachain-0.1.37-py3-none-any.whl
| Download URL | picachain-0.1.37-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
63bea92563dc9e058ebabdc93f2d69b5d7942ca152f4223d743ccecc6f6acf91
|
|
BLAKE2b-256 checksum How to use checksums |
6cc99ea810c8d8ca61a5da4346a5fa4e9f986cd2bc3a081ec9b70d02521f391b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.8.10 Linux/5.15.0-102-generic
|