use std::path::Path;
use crate::ocr::{OcrBackend, OcrError, OcrOptions};
use crate::pixmap::Pixmap;
use crate::text::TextLayer;
pub struct CandleBackend {
_private: (),
}
impl CandleBackend {
pub fn load(model_dir: impl AsRef<Path>) -> Result<Self, OcrError> {
Err(OcrError::InitFailed(format!(
"Candle OCR backend is experimental and has no supported model-specific \
implementation yet (requested model dir: {}); use the ocr-tesseract \
feature for supported OCR",
model_dir.as_ref().display()
)))
}
}
impl OcrBackend for CandleBackend {
fn recognize(&self, _pixmap: &Pixmap, _options: &OcrOptions) -> Result<TextLayer, OcrError> {
Err(OcrError::RecognitionFailed(
"Candle OCR backend is experimental and unavailable; use the ocr-tesseract feature"
.into(),
))
}
}