소스 검색

update demo model json and code

赵小蒙 1 년 전
부모
커밋
63a4a06255
3개의 변경된 파일22개의 추가작업 그리고 39021개의 파일을 삭제
  1. 22 0
      demo/demo.py
  2. 0 24521
      demo/demo1.json
  3. 0 14500
      demo/demo2.json

+ 22 - 0
demo/demo.py

@@ -0,0 +1,22 @@
+import os
+import json
+
+from magic_pdf.pipe.UNIPipe import UNIPipe
+from magic_pdf.rw.DiskReaderWriter import DiskReaderWriter
+
+current_script_dir = os.path.dirname(os.path.abspath(__file__))
+demo_name = "demo1"
+pdf_path = os.path.join(current_script_dir, f"{demo_name}.pdf")
+model_path = os.path.join(current_script_dir, f"{demo_name}.json")
+pdf_bytes = open(pdf_path, "rb").read()
+model_json = json.loads(open(model_path, "r", encoding="utf-8").read())
+jso_useful_key = {"_pdf_type": "", "model_list": model_json}
+local_image_dir = os.path.join(current_script_dir, 'images')
+image_dir = str(os.path.basename(local_image_dir))
+image_writer = DiskReaderWriter(local_image_dir)
+pipe = UNIPipe(pdf_bytes, jso_useful_key, image_writer)
+pipe.pipe_classify()
+pipe.pipe_parse()
+md_content = pipe.pipe_mk_markdown(image_dir, drop_mode="none")
+with open(f"{demo_name}.md", "w", encoding="utf-8") as f:
+    f.write(md_content)

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 24521
demo/demo1.json


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 14500
demo/demo2.json


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.