(poster_path, check_fail=True)
| 463 | |
| 464 | |
| 465 | def get_poster_text(poster_path, check_fail=True): |
| 466 | markdown_clean_pattern = re.compile(r"<!--[\s\S]*?-->") |
| 467 | converter = DocumentConverter() |
| 468 | raw_result = converter.convert(poster_path) |
| 469 | |
| 470 | raw_markdown = raw_result.document.export_to_markdown() |
| 471 | text_content = markdown_clean_pattern.sub("", raw_markdown) |
| 472 | if len(text_content) < 500 and check_fail: |
| 473 | print('\nParsing with docling failed, using marker instead\n') |
| 474 | parser_model = create_model_dict(device='cuda', dtype=torch.float16) |
| 475 | text_content, rendered = parse_pdf(poster_path, model_lst=parser_model, save_file=False) |
| 476 | return text_content |
| 477 | |
| 478 | def qwen2_vl_ppl( |
| 479 | image: Image.Image, |
no test coverage detected