Input validation and error handling
masterThe DdddOcr API enforces several constraints on input data:
- Image Constraints: Images are validated for size, format, and dimensions. The default limit is 8192 KB and a maximum side length of 4096px. These can be customized in the local library via
DdddOcr(max_image_bytes=..., max_image_side=...). - Supported Formats: PNG, JPEG, JPG, WEBP, BMP, GIF, TIFF.
- Error Handling: Invalid inputs (e.g., exceeding size limits) return a
400 Bad Request. The core library usesDdddOcrInputErrorandInvalidImageError, which the API maps to HTTP 400 errors. - Detection Mode: If the service is configured in detection mode (
det=True), calling classification methods will result in an error indicating the current mode is set to object detection.