refactor: allow the usage of backends in the enrich models and generalize the interface (#742)
* fix get image with cropbox Signed-off-by: Michele Dolfi <dol@zurich.ibm.com> * allow the usage of backends in the enrich models and generalize the interface Signed-off-by: Michele Dolfi <dol@zurich.ibm.com> * move logic in BaseTextImageEnrichmentModel Signed-off-by: Michele Dolfi <dol@zurich.ibm.com> * renaming Signed-off-by: Michele Dolfi <dol@zurich.ibm.com> --------- Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
This commit is contained in:
@@ -22,7 +22,7 @@ _log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PageAssembleOptions(BaseModel):
|
||||
keep_images: bool = False
|
||||
pass
|
||||
|
||||
|
||||
class PageAssembleModel(BasePageModel):
|
||||
@@ -174,11 +174,4 @@ class PageAssembleModel(BasePageModel):
|
||||
elements=elements, headers=headers, body=body
|
||||
)
|
||||
|
||||
# Remove page images (can be disabled)
|
||||
if not self.options.keep_images:
|
||||
page._image_cache = {}
|
||||
|
||||
# Unload backend
|
||||
page._backend.unload()
|
||||
|
||||
yield page
|
||||
|
||||
Reference in New Issue
Block a user