self-hostable ocr api for macos
git clone https://github.com/evanwashere/ocrd.git
swift run -c release
swift build -c release
- comment or configure proxy in
Sources/ocrd/api.swift:118
- add trusted domains to domains list in
Sources/ocrd/api.swift:105
- example proxy setup – wireproxy + dedicated ip/server for untrusted domains traffic
Usage: ocrd <command>
Commands:
routes Displays all registered routes.
serve Begins serving the app over HTTP.
Usage: ocrd serve [--hostname,-H] [--port,-p] [--bind,-b] [--unix-socket]
Begins serving the app over HTTP.
Options:
hostname Set the hostname the server will run on.
port Set the port the server will run on.
bind Convenience for setting hostname and port together.
unix-socket Set the path for the unix domain socket file the server will bind to.
health check endpoint
lists ocr engine revisions
lists image types supported by api
lists languages supported by the ocr engine
do ocr on a single image
- json <-
ImageSource
- bytes <- raw image bytes
words
<-str[]
revision
<-string
languages
<-str[]
autocorrect
<-bool
mode
<-fast | accurate
detect_language
<-bool
detailed description of each parameter can be found in Apple API Docs
- json <-
ImageSource[]
words
<-str[]
revision
<-string
languages
<-str[]
autocorrect
<-bool
mode
<-fast | accurate
detect_language
<-bool
detailed description of each parameter can be found in Apple API Docs
type ImageSource =
{ url: string; }
| { base64: string; }
| { bytes: number[]; }
type Result = Ok | Err;
type Err = {
error: bool;
reason: string;
}
type Ok = {
width: number;
height: number;
content: string;
observations: TextObservation[];
}
type TextObservation = {
box: Box;
content: string;
confidence: number;
}
type Box = {
x: number;
y: number;
width: number;
height: number;
}
Apache 2.0 © Evan