DocTR
Use the DocTR OCR model through our Serverless Hosted API
Code sample
curl --location 'https://serverless.roboflow.com/doctr/ocr' \
--header 'Content-Type: application/json' \
--data '{
"api_key": "YOUR_API_KEY",
"image": {"type": "url", "value": "https://media.roboflow.com/inference/license_plate_1.jpg"}
}'pip install inference-sdkimport os
import urllib.request
from inference_sdk import InferenceHTTPClient
# Sample image containing text
urllib.request.urlretrieve(
"https://media.roboflow.com/inference/license_plate_1.jpg",
"./sample.jpg",
)
client = InferenceHTTPClient(
api_url="https://serverless.roboflow.com",
api_key=os.getenv("API_KEY"),
)
result = client.ocr_image(inference_input="./sample.jpg", model="doctr")
print(result["result"]) # Extracted textLast updated
Was this helpful?