prompts.py 2.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. dict_promptmode_to_prompt = {
  2. # prompt_layout_all_en: parse all layout info in json format.
  3. "prompt_layout_all_en": """Please output the layout information from the PDF image, including each layout element's bbox, its category, and the corresponding text content within the bbox.
  4. 1. Bbox format: [x1, y1, x2, y2]
  5. 2. Layout Categories: The possible categories are ['Caption', 'Footnote', 'Formula', 'List-item', 'Page-footer', 'Page-header', 'Picture', 'Section-header', 'Table', 'Text', 'Title'].
  6. 3. Text Extraction & Formatting Rules:
  7. - Picture: For the 'Picture' category, the text field should be omitted.
  8. - Formula: Format its text as LaTeX.
  9. - Table: Format its text as HTML.
  10. - All Others (Text, Title, etc.): Format their text as Markdown.
  11. 4. Constraints:
  12. - The output text must be the original text from the image, with no translation.
  13. - All layout elements must be sorted according to human reading order.
  14. 5. Final Output: The entire output must be a single JSON object.
  15. """,
  16. # prompt_layout_only_en: layout detection
  17. "prompt_layout_only_en": """Please output the layout information from this PDF image, including each layout's bbox and its category. The bbox should be in the format [x1, y1, x2, y2]. The layout categories for the PDF document include ['Caption', 'Footnote', 'Formula', 'List-item', 'Page-footer', 'Page-header', 'Picture', 'Section-header', 'Table', 'Text', 'Title']. Do not output the corresponding text. The layout result should be in JSON format.""",
  18. # prompt_layout_only_en: parse ocr text except the Page-header and Page-footer
  19. "prompt_ocr": """Extract the text content from this image.""",
  20. # prompt_grounding_ocr: extract text content in the given bounding box
  21. "prompt_grounding_ocr": """Extract text from the given bounding box on the image (format: [x1, y1, x2, y2]).\nBounding Box:\n""",
  22. # "prompt_table_html": """Convert the table in this image to HTML.""",
  23. # "prompt_table_latex": """Convert the table in this image to LaTeX.""",
  24. # "prompt_formula_latex": """Convert the formula in this image to LaTeX.""",
  25. }