Extract structured data from images using AI models.
Project description
Define the output schema, pass the image, pick the AI model, and get parsed structured output back instead of free-form text.
📦 Installation
pip install viscribe
🚀 Features
- 🖼️ One schema-driven
extracthelper for image workflows - 🔄 Sync and async helpers:
extractandaextract - 📊 Pydantic models, JSON Schema dictionaries, and simple field definitions
- 📁 Local image paths, base64 images, and remote image URLs
- ⚙️ Reusable
ViscribeAI().images.extractclient namespace - 🧩 OpenAI-compatible model configuration
🎯 Quick Start
from pydantic import BaseModel, Field
from viscribe.images import extract
class Receipt(BaseModel):
merchant_name: str | None = Field(description="Store or business name")
total_amount: float | None = Field(description="Final total on the receipt")
date: str | None = Field(description="Receipt date if visible")
line_items: list[str] = Field(description="Visible purchased items")
result = extract(
image_path="examples/receipt.png",
output_schema=Receipt,
instruction="Extract the receipt fields visible in the image.",
model_config={
"model": "gpt-5-mini",
"api_key": "sk-...",
"temperature": 1,
},
)
print(result.data.model_dump())
🧱 Schema Options
output_schema accepts:
- simple field definitions
- JSON Schema dictionaries
- Pydantic model classes
Simple field types are text, number, array_text, and array_number.
⚡ Async
from viscribe.images import aextract
result = await aextract(
image_url="https://example.com/receipt.png",
output_schema=[{"name": "total_amount", "type": "number"}],
instruction="Extract the visible receipt total.",
)
♻️ Reusable Client
from viscribe import ViscribeAI
client = ViscribeAI(model_config={"model": "gpt-5-mini", "temperature": 1})
result = client.images.extract(
image_path="examples/receipt.png",
output_schema=[{"name": "total_amount", "type": "number"}],
)
💬 Support & Feedback
- 📧 Email: support@viscribe.ai
- 💻 GitHub Issues: Create an issue
- 💬 Discord: Join the community
🤝 Contributing
Please see the contributing guidelines.
🛠️ Development
uv sync
uv run ruff check .
uv run python -m pytest
uv build
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
viscribe-1.1.0.tar.gz
(5.5 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
viscribe-1.1.0-py3-none-any.whl
(11.1 kB
view details)
File details
Details for the file viscribe-1.1.0.tar.gz.
File metadata
- Download URL: viscribe-1.1.0.tar.gz
- Upload date:
- Size: 5.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e14bc1d22a89ed4840e5fa3b7d876f9c565e6917d155b2a9c2e89ebcee4be0d4
|
|
| MD5 |
8214ca0a19f8f82e82254d4b12085f0a
|
|
| BLAKE2b-256 |
935178f4a85ae2df18d2523f968187dbe1b7986eacace176d55da7408923be97
|
File details
Details for the file viscribe-1.1.0-py3-none-any.whl.
File metadata
- Download URL: viscribe-1.1.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d65808b962f951ccc220a6446ef66f393544a5ec71e2a84eb1e88b2e2a8f5e3b
|
|
| MD5 |
f2470b6873618b5f6848e51881624be7
|
|
| BLAKE2b-256 |
5338f71c8faa2a4223a33315142143c030f35bb9b3e23abd779884ae9d1133e7
|