Skip to main content

Lightweight, stateless Python library for extracting structured data from product packaging labels using OCR and LLM-based parsing.

PyPI version Python 3.8+ License: MIT

—

Features

  • Stateless & In-Memory: Processes raw image bytes—no disk I/O, ideal for serverless (FastAPI/Flask).

  • OCR + LLM Powered: Uses PaddleOCR for text extraction and Mistral AI (mistral-small-latest) for structured parsing.

  • Noise Filtering: Automatically cleans low-confidence OCR text and groups spatial blocks (rows/columns/proximity).

  • Flexible Auth: Pass api_key directly or via MISTRAL_API_KEY environment variable.

  • Structured JSON Output: Extracts brand, product name, ingredients, nutrition facts, allergens, and more.

—

Installation

pip install tejas-label-ocr

—

Usage

Front Label Processing

from label_ocr import process_front_label

with open("product_label.jpg", "rb") as f:
    image_bytes = f.read()

result = process_front_label(image_bytes, api_key="your-mistral-api-key")
print(result)
# Output: {"brand": "Nestlé", "product_name": "Organic Oats", "claims": ["Gluten-Free", "Non-GMO"], ...}

Nutrition Label Processing

from label_ocr import process_nutrition_label

with open("nutrition_panel.jpg", "rb") as f:
    image_bytes = f.read()

result = process_nutrition_label(image_bytes, api_key="your-mistral-api-key")
print(result)
# Output: {"serving_size": "30g", "nutrients": [{"name": "Calories", "value": 120, "unit": "kcal", "%RDA": 6}], ...}

— Notes —–

  • Requires a Mistral AI API key (sign up at Mistral AI).

  • For best results, use high-resolution images of labels with clear text.

Metadata

Release files for tejas-label-ocr 0.1.9.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tejas-label-ocr 0.1.9.4
File Size Uploaded
tejas_label_ocr-0.1.9.4.tar.gz 7.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tejas-label-ocr 0.1.9.4
File Interpreter ABI Platform
tejas_label_ocr-0.1.9.4-py3-none-any.whl Python 3 none any Details

Total release size: 15.4 kB

Release files / tejas_label_ocr-0.1.9.4.tar.gz

Download URL tejas_label_ocr-0.1.9.4.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5a1329ab54f0ca87e4fde51bb2da49c7be98279a9d7c0278afc91ca8f15cf89e
BLAKE2b-256 checksum
How to use checksums
bc18265588090d39a05a0e54799c8e892d6dfa0b9b59d92a4748dcbada942e48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.9

Release files / tejas_label_ocr-0.1.9.4-py3-none-any.whl

Download URL tejas_label_ocr-0.1.9.4-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
531e9ba7e1cb65f4ac776c6581525002b62f51519f5591a3b2ddc432e3c943b5
BLAKE2b-256 checksum
How to use checksums
3e9f1c38528683aa9b89ded67ac9dae4d4e95a442fba01b4fee84ad38193d52b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.9

Release history Release notifications | RSS feed

0.2.0

2 release files

This release

0.1.9.4 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page