Skip to main content

OCY

OCY - Python OCR SDK

Lightweight OCR for developer screenshots — extract text from code images, terminals, and IDE windows with one line of code.

Made by Samin Yeasar • github.com/solez-ai • x.com/Solez_None

Installation

pip install ocy

Quick Start

1. Set your API URL

First, set the API URL. You can use a self-hosted instance or a public one:

import ocy

# Set your API URL (required)
ocy.set_api_url("https://your-api.vercel.app")

2. Extract text from a URL

result = ocy.extract_text("https://example.com/screenshot.png")
print(result["text"])
print(f"Confidence: {result['confidence']:.1%}")

3. Extract text from a local file

result = ocy.extract_text("./myScreenshot.png")
print(result["text"])

4. Async usage

import asyncio
import ocy

async def main():
    result = await ocy.extract_text_async("https://example.com/code.png")
    print(result["text"])

asyncio.run(main())

5. Use an API key

import ocy

# Option 1: Per-request key
result = ocy.extract_text("https://example.com/screenshot.png", api_key="your-key")

# Option 2: Set global key
ocy.set_api_key("your-key")
result = ocy.extract_text("https://example.com/screenshot.png")

Response Format

{
    "text": "extracted text from image...",
    "confidence": 0.95,        # 0.0 to 1.0
    "latency_ms": 150,         # processing time in milliseconds
    "model": "ocy-v1-int8",    # model identifier
    "chars_detected": 42       # number of characters detected
}

API Reference

Function Description
extract_text(img, api_key=None) Extract text synchronously
extract_text_async(img, api_key=None) Extract text asynchronously
set_api_url(url) Set custom API endpoint
set_api_key(key) Set global API key

License

MIT License - See LICENSE for details.

Metadata

Release files for ocy 1.0.1

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

Source distribution (sdist)

Source distribution for ocy 1.0.1
File Size Uploaded Provenance Actions
ocy-1.0.1.tar.gz 3.7 kB Without provenance Details for ocy-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ocy 1.0.1
File Interpreter ABI Platform Actions
ocy-1.0.1-py3-none-any.whl Python 3 none any Details for ocy-1.0.1-py3-none-any.whl

Total release size: 7.4 kB

Release files / ocy-1.0.1.tar.gz

Download URL ocy-1.0.1.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3c376ea08b4287fd5569b4244dfc693aff0b4f40c16fd965d60d60ee73009bc0
BLAKE2b-256 checksum
How to use checksums
d5d1e71e5fba01eaea8c96b1592aa75f254ec8d245357822733244018e4432f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.0

Release files / ocy-1.0.1-py3-none-any.whl

Download URL ocy-1.0.1-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd99eb4bac427ea831a0ce88163d2113241af5c4bdb4bf9cf1126bdbc3b2f0bc
BLAKE2b-256 checksum
How to use checksums
05de35e0b0cb5a631838af6df104305c21bfc5968cc9c783c529c322b3c3fa2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.0

Security for ocy 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

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