MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / get_poster_text

Function get_poster_text

utils/poster_eval_utils.py:465–476  ·  view source on GitHub ↗
(poster_path, check_fail=True)

Source from the content-addressed store, hash-verified

463
464
465def 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
478def qwen2_vl_ppl(
479 image: Image.Image,

Callers 4

write_poster_textsFunction · 0.90
gen_eval_markdownFunction · 0.70

Calls 4

convertMethod · 0.95
DocumentConverterClass · 0.90
parse_pdfFunction · 0.90
subMethod · 0.45

Tested by

no test coverage detected