37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
|
import logging
|
|||
|
|
|||
|
from Util.GGB.GGB_1_CUT import yoloCut
|
|||
|
from Util.GGB.GGB_2_OCR import pix2text_ocr
|
|||
|
from Util.GGB.GGB_3_GLM import batch_glm
|
|||
|
from Util.GGB.GGB_4_LLM import generate_ggb
|
|||
|
|
|||
|
# 更详细地控制日志输出
|
|||
|
logger = logging.getLogger('GGB')
|
|||
|
logger.setLevel(logging.INFO)
|
|||
|
handler = logging.StreamHandler()
|
|||
|
handler.setFormatter(logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s'))
|
|||
|
logger.addHandler(handler)
|
|||
|
|
|||
|
if __name__ == '__main__':
|
|||
|
# 图片路径
|
|||
|
image_path = '../../Test/img10.jpg'
|
|||
|
|
|||
|
# 步骤1:调用yoloCut函数
|
|||
|
output_dir, processed_image_path, img_list = yoloCut(image_path)
|
|||
|
|
|||
|
# 步骤2:调用pix2text_ocr函数
|
|||
|
ocr_result = pix2text_ocr(output_dir, processed_image_path)
|
|||
|
logger.info(f"成功生成文字+公式OCR文件: {ocr_result}")
|
|||
|
|
|||
|
# 步骤3:调用QVQ解析图片
|
|||
|
qvq_result = batch_glm(output_dir, img_list)
|
|||
|
logger.info(f"成功生成图形解析文件: {qvq_result}")
|
|||
|
|
|||
|
# 步骤4:生成GGB指令
|
|||
|
ggb = generate_ggb(ocr_result, qvq_result, output_dir)
|
|||
|
logger.info(f"成功生成GGB文件: {ggb}")
|
|||
|
|
|||
|
# 步骤5:输出GGB指令集
|
|||
|
with open(ggb, 'r', encoding='utf-8') as f:
|
|||
|
print(f.read())
|