mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-07 12:00:44 +08:00
Feat: Add knowledge compilation workflows (#16515)
## Summary - Add knowledge compilation template APIs, services, and builtin template seed data - Add advanced knowledge compile structure/artifact/RAPTOR workflow support - Update parsing, dataset/document APIs, and supporting services for compilation workflows
This commit is contained in:
@@ -701,11 +701,11 @@ class RAGFlowPdfParser:
|
||||
logging.info(f"Added {added} OCR results from rotated table {table_index}")
|
||||
|
||||
def __ocr(self, pagenum, img, chars, ZM=3, device_id: int | None = None):
|
||||
start = timer()
|
||||
# start = timer()
|
||||
bxs = self.ocr.detect(np.array(img), device_id)
|
||||
logging.info(f"__ocr detecting boxes of an image cost ({timer() - start}s)")
|
||||
# logging.info(f"__ocr detecting boxes of an image cost ({timer() - start}s)")
|
||||
|
||||
start = timer()
|
||||
# start = timer()
|
||||
if not bxs:
|
||||
self.boxes.append([])
|
||||
return
|
||||
@@ -771,8 +771,8 @@ class RAGFlowPdfParser:
|
||||
)
|
||||
b["text"] = ""
|
||||
|
||||
logging.info(f"__ocr sorting {len(chars)} chars cost {timer() - start}s")
|
||||
start = timer()
|
||||
# logging.info(f"__ocr sorting {len(chars)} chars cost {timer() - start}s")
|
||||
# start = timer()
|
||||
boxes_to_reg = []
|
||||
img_np = None
|
||||
for b in bxs:
|
||||
@@ -787,7 +787,7 @@ class RAGFlowPdfParser:
|
||||
for i in range(len(boxes_to_reg)):
|
||||
boxes_to_reg[i]["text"] = texts[i]
|
||||
del boxes_to_reg[i]["box_image"]
|
||||
logging.info(f"__ocr recognize {len(bxs)} boxes cost {timer() - start}s")
|
||||
# logging.info(f"__ocr recognize {len(bxs)} boxes cost {timer() - start}s")
|
||||
bxs = [b for b in bxs if b["text"]]
|
||||
if self.mean_height[pagenum - 1] == 0:
|
||||
self.mean_height[pagenum - 1] = np.median([b["bottom"] - b["top"] for b in bxs])
|
||||
|
||||
Reference in New Issue
Block a user