Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 723 Bytes

File metadata and controls

41 lines (31 loc) · 723 Bytes

How To

Edit configuration file

UI_PORT=<YOUR_PORT_1>
API_PORT=<YOUR_PORT_2>
CUDA_VISIBLE_DEVICES=0

Run service (about 120 s for readiness)

set -a
source .env
set +a
docker pull ghcr.io/machine-intelligence-laboratory/ocr-demo:latest
docker compose up -d

Usage

  • UI is available at http://localhost:<YOUR_PORT_1>
  • API is available at http://localhost:<YOUR_PORT_2>/v1/ocr
import requests

url = "http://localhost:<YOUR_PORT_2>/v1/ocr"

files = {
    "image": open("1.pdf", "rb")
}

response = requests.post(url, files=files)
if response.status_code == 200:
    print(response.json())
else:
    print(f"Error: {response.status_code}")
    print(response.text)