feat: 字符集限制枚举优化与核心解码器对接

- 新增 model_metadata.rs
- 优化 charset.rs
- 其他优化
This commit is contained in:
2026-06-05 17:30:10 +08:00
parent cb786a7a1a
commit 15ce068025
5 changed files with 345 additions and 89 deletions

View File

@@ -2,6 +2,7 @@ mod charset;
pub mod models;
pub mod utils;
mod model_metadata;
use anyhow::Result;
use image::DynamicImage;
@@ -94,7 +95,7 @@ impl Display for DdddOcr {
impl DdddOcr {
pub fn classification(&self, img: &DynamicImage) -> Result<String> {
match &self.runtime {
Runtime::Ocr(s) => s.predict(img, false),
Runtime::Ocr(s) => s.predict(img).run(),
Runtime::Det(_) => Err(anyhow::anyhow!("当前模型是检测模型,无法执行 OCR")),
}
}