OCR de imagenes con Mistral: ImageProcessor (png/jpg/webp/gif/bmp/tiff), modelo mistral-ocr-latest y recuperacion de fuentes unknown
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from backend.app.services.markdown_builder import title_from_path
|
||||
from backend.app.services.processors.base import ProcessedContent
|
||||
from backend.app.services.providers.mistral_client import MistralClient
|
||||
|
||||
|
||||
class ImageProcessor:
|
||||
"""Procesa imagenes sueltas (png, jpg, webp, gif, bmp, tiff) con Mistral OCR.
|
||||
|
||||
No hay extraccion de texto alternativa para imagenes: siempre pasan por
|
||||
OCR, independiente de la opcion ``use_ocr``.
|
||||
"""
|
||||
|
||||
def process(self, path: Path) -> ProcessedContent:
|
||||
markdown = MistralClient().ocr_image(path)
|
||||
return ProcessedContent(title=title_from_path(path), body=markdown, processor="mistral-ocr-image")
|
||||
Reference in New Issue
Block a user