47 lines
2.6 KiB
Python
Executable File
47 lines
2.6 KiB
Python
Executable File
dict_promptmode_to_prompt = {
|
|
# prompt_layout_all_en: parse all layout info in json format.
|
|
"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.
|
|
|
|
1. Bbox format: [x1, y1, x2, y2]
|
|
|
|
2. Layout Categories: The possible categories are ['Caption', 'Footnote', 'Formula', 'List-item', 'Page-footer', 'Page-header', 'Picture', 'Section-header', 'Table', 'Text', 'Title'].
|
|
|
|
3. Text Extraction & Formatting Rules:
|
|
- Picture: For the 'Picture' category, the text field should be omitted.
|
|
- Formula: Format its text as LaTeX.
|
|
- Table: Format its text as HTML.
|
|
- All Others (Text, Title, etc.): Format their text as Markdown.
|
|
|
|
4. Constraints:
|
|
- The output text must be the original text from the image, with no translation.
|
|
- All layout elements must be sorted according to human reading order.
|
|
|
|
5. Final Output: The entire output must be a single JSON object.
|
|
""",
|
|
|
|
# prompt_layout_only_en: layout detection
|
|
"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.""",
|
|
|
|
# prompt_ocr: parse ocr text except the Page-header and Page-footer
|
|
"prompt_ocr": """Extract the text content from this image.""",
|
|
|
|
# prompt_grounding_ocr: extract text content in the given bounding box
|
|
"prompt_grounding_ocr": """Extract text from the given bounding box on the image (format: [x1, y1, x2, y2]).\nBounding Box:\n""",
|
|
|
|
# prompt_web_parsing: parse all webpage layout info in json format.
|
|
"prompt_web_parsing": """Parsing the layout info of this webpage image with format json:\n""",
|
|
|
|
# prompt_scene_spotting: scene spotting
|
|
"prompt_scene_spotting": """Detect and recognize the text in the image.""",
|
|
|
|
# prompt_img2svg: generate the SVG code of the image
|
|
"prompt_image_to_svg": """Please generate the SVG code based on the image.viewBox="0 0 {width} {height}\"""",
|
|
|
|
# prompt_free_qa: general prompt
|
|
"prompt_general": """ """,
|
|
|
|
# "prompt_table_html": """Convert the table in this image to HTML.""",
|
|
# "prompt_table_latex": """Convert the table in this image to LaTeX.""",
|
|
# "prompt_formula_latex": """Convert the formula in this image to LaTeX.""",
|
|
}
|