DocTR is an Optical Character Recognition (OCR) model. You can use DocTR to read the text in an image.
DocTR is an Optical Character Recognition (OCR) model.
You can use DocTR to read the text in an image.
To use DocTR with Inference, you will need a Roboflow API key. If you don't already have a Roboflow account, sign up for a free Roboflow account.
Then, retrieve your API key from the Roboflow dashboard. Learn how to retrieve your API key.
Run the following command to set your API key in your coding environment:
export ROBOFLOW_API_KEY=<your api key>
Use the following code to run DocTR:
import os
from inference_sdk import InferenceHTTPClient
CLIENT = InferenceHTTPClient(
api_url="https://infer.roboflow.com",
api_key=os.environ["ROBOFLOW_API_KEY"]
)
result = CLIENT.ocr_image(inference_input="./container.jpg") # single image request
print(result)