PP-ChatOCRv4-doc.yaml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. pipeline_name: PP-ChatOCRv4-doc
  2. use_mllm_predict: True
  3. SubModules:
  4. LLM_Chat:
  5. module_name: chat_bot
  6. model_name: ernie-3.5
  7. api_type: qianfan
  8. ak: "api_key" # Set this to a real API key
  9. sk: "secret_key" # Set this to a real secret key
  10. LLM_Retriever:
  11. module_name: retriever
  12. model_name: ernie-3.5
  13. api_type: qianfan
  14. ak: "api_key" # Set this to a real API key
  15. sk: "secret_key" # Set this to a real secret key
  16. PromptEngneering:
  17. KIE_CommonText:
  18. module_name: prompt_engneering
  19. task_type: text_kie_prompt_v2
  20. task_description: '你现在的任务是从OCR结果中提取问题列表中每一个问题的答案。
  21. OCR的文字识别结果使用```符号包围,包含所识别出来的文字,顺序在原始图片中从左至右、从上至下。
  22. 我指定的问题列表使用[]符号包围。请注意OCR的文字识别结果可能存在长句子换行被切断、不合理的分词、
  23. 文字被错误合并等问题,你需要结合上下文语义进行综合判断,以获取准确的答案。'
  24. output_format: '在返回结果时使用JSON格式,包含多个key-value对,key值为我指定的问题,value值为该问题对应的答案。
  25. 如果认为OCR识别结果中,对于问题key,没有答案,则将value赋值为"未知"。请只输出json格式的结果,
  26. 并做json格式校验后返回,不要包含其它多余文字!'
  27. rules_str: '请依次确认满足下面要求。(1)每个问题的答案用OCR结果的内容回答,针对问题回答尽可能详细和完整,
  28. 并保持格式、数字、正负号、单位、符号和标点都与OCR结果中的内容完全一致。
  29. (2)如果答案的句末有标点符号,请添加标点符号。
  30. (3)对于答案中的数字,如果可以推断出单位,请补充相应的单位。'
  31. few_shot_demo_text_content:
  32. few_shot_demo_key_value_list:
  33. KIE_Table:
  34. module_name: prompt_engneering
  35. task_type: table_kie_prompt_v2
  36. task_description: '你现在的任务是从输入的html格式的表格内容中提取问题列表中每一个问题的答案。
  37. 表格内容使用```符号包围,我指定的问题列表使用[]符号包围。'
  38. output_format: '在返回结果时使用JSON格式,包含多个key-value对,key值为我指定的问题,value值为该问题对应的答案。
  39. 如果认为表格内容中,对于问题key,没有答案,则将value赋值为"未知"。请只输出json格式的结果,
  40. 并做json格式校验后返回,不要包含其它多余文字!'
  41. rules_str: '请依次确认满足下面要求。(1)每个问题的答案用表格内容回答,针对问题回答尽可能详细和完整,
  42. 并保持格式、数字、正负号、单位、符号和标点都与表格内容完全一致。
  43. (2)对于答案中的数字,如果可以推断出单位,请补充相应的单位。
  44. (3)如果答案是百分比,请添加百分号。'
  45. few_shot_demo_text_content:
  46. few_shot_demo_key_value_list:
  47. Ensemble:
  48. module_name: prompt_engneering
  49. task_type: ensemble_prompt
  50. task_description: '你现在的任务是,对于一个问题,对比方法A和方法B的结果,选择更准确的一个回答。
  51. 问题用```符号包围。'
  52. output_format: '请返回JSON格式的结果,包含多个key-value对,key值为我指定的问题,
  53. value值为`方法A`或`方法B`。如果对于问题key,没有找到答案,将value赋值为"未知"。
  54. 请只输出json格式的结果,并做json格式校验后返回,不要包含其它多余文字!'
  55. rules_str: '对于涉及数字的问题,请返回与问题描述最相关且数字表述正确的答案。
  56. 请特别注意数字中的标点使用是否合理。'
  57. few_shot_demo_text_content:
  58. few_shot_demo_key_value_list:
  59. SubPipelines:
  60. LayoutParser:
  61. pipeline_name: layout_parsing
  62. use_doc_preprocessor: True
  63. use_general_ocr: True
  64. use_seal_recognition: True
  65. use_table_recognition: True
  66. SubModules:
  67. LayoutDetection:
  68. module_name: layout_detection
  69. model_name: RT-DETR-H_layout_3cls
  70. model_dir: null
  71. batch_size: 1
  72. SubPipelines:
  73. DocPreprocessor:
  74. pipeline_name: doc_preprocessor
  75. use_doc_orientation_classify: True
  76. use_doc_unwarping: True
  77. SubModules:
  78. DocOrientationClassify:
  79. module_name: doc_text_orientation
  80. model_name: PP-LCNet_x1_0_doc_ori
  81. model_dir: null
  82. batch_size: 1
  83. DocUnwarping:
  84. module_name: image_unwarping
  85. model_name: UVDoc
  86. model_dir: null
  87. batch_size: 1
  88. GeneralOCR:
  89. pipeline_name: OCR
  90. text_type: general
  91. SubModules:
  92. TextDetection:
  93. module_name: text_detection
  94. model_name: PP-OCRv4_server_det
  95. model_dir: null
  96. batch_size: 1
  97. TextRecognition:
  98. module_name: text_recognition
  99. model_name: PP-OCRv4_server_rec
  100. model_dir: null
  101. batch_size: 1
  102. TableRecognition:
  103. pipeline_name: table_recognition
  104. use_layout_detection: False
  105. use_doc_preprocessor: False
  106. use_ocr_model: False
  107. SubModules:
  108. TableStructureRecognition:
  109. module_name: table_structure_recognition
  110. model_name: SLANet_plus
  111. model_dir: null
  112. batch_size: 1
  113. SealRecognition:
  114. pipeline_name: seal_recognition
  115. use_layout_detection: False
  116. use_doc_preprocessor: False
  117. SubPipelines:
  118. SealOCR:
  119. pipeline_name: OCR
  120. text_type: seal
  121. SubModules:
  122. TextDetection:
  123. module_name: seal_text_detection
  124. model_name: PP-OCRv4_server_seal_det
  125. model_dir: null
  126. batch_size: 1
  127. TextRecognition:
  128. module_name: text_recognition
  129. model_name: PP-OCRv4_server_rec
  130. model_dir: null
  131. batch_size: 1