GLM-OCR
Use GLM-OCR for image OCR through our Serverless Hosted API
Code sample
curl --location 'https://serverless.roboflow.com/infer/lmm' \
--header 'Content-Type: application/json' \
--data '{
"api_key": "YOUR_API_KEY",
"image": {"type": "url", "value": "https://media.roboflow.com/inference/license_plate_1.jpg"},
"model_id": "glm-ocr",
"prompt": "OCR",
"max_new_tokens": 128
}'pip install inference-sdkimport os
import urllib.request
from inference_sdk import InferenceHTTPClient
image_url = "https://media.roboflow.com/inference/license_plate_1.jpg"
image_path = "license_plate_1.jpg"
urllib.request.urlretrieve(image_url, image_path)
client = InferenceHTTPClient(
api_url="https://serverless.roboflow.com",
api_key=os.getenv("API_KEY"),
)
result = client.infer_lmm(
image_path,
model_id="glm-ocr",
prompt="OCR",
max_new_tokens=128,
)
print(result["response"])Last updated
Was this helpful?