diff --git a/LICENSE.md b/LICENSE.md
index a688e21f..fe6b9036 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -660,6 +660,3 @@ if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
.
-
-
-$^1$
\ No newline at end of file
diff --git a/README.md b/README.md
index e9002db7..a9662ba7 100644
--- a/README.md
+++ b/README.md
@@ -14,14 +14,9 @@
[](https://pepy.tech/project/magic-pdf)
[](https://pepy.tech/project/magic-pdf)
-<<<<<<< HEAD
-[](https://huggingface.co/spaces/opendatalab/MinerU)
-[](https://www.modelscope.cn/studios/OpenDataLab/MinerU)
-=======
[](https://opendatalab.com/OpenSourceTools/Extractor/PDF)
[](https://huggingface.co/spaces/opendatalab/MinerU)
[](https://www.modelscope.cn/studios/OpenDataLab/MinerU)
->>>>>>> 0140d7d271ac3b1561ca2272030e9e038b469999
[](https://colab.research.google.com/gist/papayalove/b5f4913389e7ff9883c6b687de156e78/mineru_demo.ipynb)
[](#)
diff --git a/README_zh-CN.md b/README_zh-CN.md
index 21e26bdc..20093bac 100644
--- a/README_zh-CN.md
+++ b/README_zh-CN.md
@@ -14,14 +14,9 @@
[](https://pepy.tech/project/magic-pdf)
[](https://pepy.tech/project/magic-pdf)
-<<<<<<< HEAD
-[](https://huggingface.co/spaces/opendatalab/MinerU)
-[](https://www.modelscope.cn/studios/OpenDataLab/MinerU)
-=======
[](https://opendatalab.com/OpenSourceTools/Extractor/PDF)
[](https://www.modelscope.cn/studios/OpenDataLab/MinerU)
[](https://huggingface.co/spaces/opendatalab/MinerU)
->>>>>>> 0140d7d271ac3b1561ca2272030e9e038b469999
[](https://colab.research.google.com/gist/papayalove/b5f4913389e7ff9883c6b687de156e78/mineru_demo.ipynb)
[](#)
@@ -185,13 +180,9 @@ https://github.com/user-attachments/assets/4bea02c9-6d54-4cd6-97ed-dff14340982c
### 在线体验
-<<<<<<< HEAD
-[在线体验点击这里](https://opendatalab.com/OpenSourceTools/Extractor/PDF)
-=======
[](https://opendatalab.com/OpenSourceTools/Extractor/PDF)
[](https://www.modelscope.cn/studios/OpenDataLab/MinerU)
[](https://huggingface.co/spaces/opendatalab/MinerU)
->>>>>>> 0140d7d271ac3b1561ca2272030e9e038b469999
### 使用CPU快速体验
diff --git a/app.py b/app.py
deleted file mode 100644
index ec14972f..00000000
--- a/app.py
+++ /dev/null
@@ -1,167 +0,0 @@
-# Copyright (c) Opendatalab. All rights reserved.
-
-import base64
-import os
-import time
-import zipfile
-from pathlib import Path
-import re
-
-from loguru import logger
-
-from magic_pdf.libs.hash_utils import compute_sha256
-from magic_pdf.rw.AbsReaderWriter import AbsReaderWriter
-from magic_pdf.rw.DiskReaderWriter import DiskReaderWriter
-from magic_pdf.tools.common import do_parse, prepare_env
-
-os.system("pip install gradio")
-os.system("pip install gradio-pdf")
-import gradio as gr
-from gradio_pdf import PDF
-
-
-def read_fn(path):
- disk_rw = DiskReaderWriter(os.path.dirname(path))
- return disk_rw.read(os.path.basename(path), AbsReaderWriter.MODE_BIN)
-
-
-def parse_pdf(doc_path, output_dir, end_page_id):
- os.makedirs(output_dir, exist_ok=True)
-
- try:
- file_name = f"{str(Path(doc_path).stem)}_{time.time()}"
- pdf_data = read_fn(doc_path)
- parse_method = "auto"
- local_image_dir, local_md_dir = prepare_env(output_dir, file_name, parse_method)
- do_parse(
- output_dir,
- file_name,
- pdf_data,
- [],
- parse_method,
- False,
- end_page_id=end_page_id,
- )
- return local_md_dir, file_name
- except Exception as e:
- logger.exception(e)
-
-
-def compress_directory_to_zip(directory_path, output_zip_path):
- """
- 压缩指定目录到一个 ZIP 文件。
-
- :param directory_path: 要压缩的目录路径
- :param output_zip_path: 输出的 ZIP 文件路径
- """
- try:
- with zipfile.ZipFile(output_zip_path, 'w', zipfile.ZIP_DEFLATED) as zipf:
-
- # 遍历目录中的所有文件和子目录
- for root, dirs, files in os.walk(directory_path):
- for file in files:
- # 构建完整的文件路径
- file_path = os.path.join(root, file)
- # 计算相对路径
- arcname = os.path.relpath(file_path, directory_path)
- # 添加文件到 ZIP 文件
- zipf.write(file_path, arcname)
- return 0
- except Exception as e:
- logger.exception(e)
- return -1
-
-
-def image_to_base64(image_path):
- with open(image_path, "rb") as image_file:
- return base64.b64encode(image_file.read()).decode('utf-8')
-
-
-def replace_image_with_base64(markdown_text, image_dir_path):
- # 匹配Markdown中的图片标签
- pattern = r'\!\[(?:[^\]]*)\]\(([^)]+)\)'
-
- # 替换图片链接
- def replace(match):
- relative_path = match.group(1)
- full_path = os.path.join(image_dir_path, relative_path)
- base64_image = image_to_base64(full_path)
- return f""
-
- # 应用替换
- return re.sub(pattern, replace, markdown_text)
-
-
-def to_markdown(file_path, end_pages):
- # 获取识别的md文件以及压缩包文件路径
- local_md_dir, file_name = parse_pdf(file_path, './output', end_pages - 1)
- archive_zip_path = os.path.join("./output", compute_sha256(local_md_dir) + ".zip")
- zip_archive_success = compress_directory_to_zip(local_md_dir, archive_zip_path)
- if zip_archive_success == 0:
- logger.info("压缩成功")
- else:
- logger.error("压缩失败")
- md_path = os.path.join(local_md_dir, file_name + ".md")
- with open(md_path, 'r', encoding='utf-8') as f:
- txt_content = f.read()
- md_content = replace_image_with_base64(txt_content, local_md_dir)
- # 返回转换后的PDF路径
- new_pdf_path = os.path.join(local_md_dir, file_name + "_layout.pdf")
-
- return md_content, txt_content, archive_zip_path, new_pdf_path
-
-
-# def show_pdf(file_path):
-# with open(file_path, "rb") as f:
-# base64_pdf = base64.b64encode(f.read()).decode('utf-8')
-# pdf_display = f'