inferenceFromBytes method
Run inference on raw image bytes.
Handles preprocessing (resize, normalize) automatically.
imageBytes: raw image file bytes (PNG, JPEG, etc.)
prompt: task prompt string
maxLength: maximum generation length
Implementation
DonutResult inferenceFromBytes({
required List<int> imageBytes,
required String prompt,
int? maxLength,
}) {
final imageTensor = DonutImageUtils.preprocessBytes(imageBytes, config);
return inference(
imageTensor: imageTensor,
prompt: prompt,
maxLength: maxLength,
);
}