Spaces:
Sleeping
Sleeping
Commit
·
ff75fe0
1
Parent(s):
2691833
bugfix: prevent model load on every extraction
Browse files
medrag_multi_modal/document_loader/image_loader/marker_img_loader.py
CHANGED
@@ -50,6 +50,7 @@ class MarkerImageLoader(BaseImageLoader):
|
|
50 |
|
51 |
def __init__(self, url: str, document_name: str, document_file_path: str):
|
52 |
super().__init__(url, document_name, document_file_path)
|
|
|
53 |
|
54 |
async def extract_page_data(
|
55 |
self, page_idx: int, image_save_dir: str, **kwargs
|
@@ -72,11 +73,9 @@ class MarkerImageLoader(BaseImageLoader):
|
|
72 |
- "file_url": (str) the URL of the PDF file.
|
73 |
- "image_file_path": (str) the local file path where the image is stored.
|
74 |
"""
|
75 |
-
model_lst = load_all_models()
|
76 |
-
|
77 |
_, images, out_meta = convert_single_pdf(
|
78 |
self.document_file_path,
|
79 |
-
model_lst,
|
80 |
max_pages=1,
|
81 |
batch_multiplier=1,
|
82 |
start_page=page_idx,
|
|
|
50 |
|
51 |
def __init__(self, url: str, document_name: str, document_file_path: str):
|
52 |
super().__init__(url, document_name, document_file_path)
|
53 |
+
self.model_lst = load_all_models()
|
54 |
|
55 |
async def extract_page_data(
|
56 |
self, page_idx: int, image_save_dir: str, **kwargs
|
|
|
73 |
- "file_url": (str) the URL of the PDF file.
|
74 |
- "image_file_path": (str) the local file path where the image is stored.
|
75 |
"""
|
|
|
|
|
76 |
_, images, out_meta = convert_single_pdf(
|
77 |
self.document_file_path,
|
78 |
+
self.model_lst,
|
79 |
max_pages=1,
|
80 |
batch_multiplier=1,
|
81 |
start_page=page_idx,
|