iframe (#14)
Browse files- Switch Space to static embedded demo (108d2572fa717b1f640e8cb29ee872ff5b654351)
- .gitattributes +1 -1
- README.md +6 -9
- app.py +0 -42
- index.html +49 -0
- packages.txt +0 -2
- requirements.txt +0 -2
.gitattributes
CHANGED
|
@@ -32,7 +32,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 32 |
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -
|
| 36 |
examples/demo1.docx filter=lfs diff=lfs merge=lfs -text
|
| 37 |
examples/demo1.pdf filter=lfs diff=lfs merge=lfs -text
|
| 38 |
examples/demo2.pdf filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 32 |
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
examples/demo1.docx filter=lfs diff=lfs merge=lfs -text
|
| 37 |
examples/demo1.pdf filter=lfs diff=lfs merge=lfs -text
|
| 38 |
examples/demo2.pdf filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -3,20 +3,17 @@ title: MinerU Document Extraction Tools
|
|
| 3 |
emoji: 📚
|
| 4 |
colorFrom: purple
|
| 5 |
colorTo: blue
|
| 6 |
-
sdk:
|
| 7 |
-
|
| 8 |
-
app_file: app.py
|
| 9 |
pinned: true
|
| 10 |
license: apache-2.0
|
| 11 |
-
python_version: 3.12
|
| 12 |
-
models:
|
| 13 |
-
- opendatalab/PDF-Extract-Kit-1.0
|
| 14 |
-
- opendatalab/MinerU2.5-Pro-2605-1.2B
|
| 15 |
thumbnail: >-
|
| 16 |
https://cdn-uploads.huggingface.co/production/uploads/668f77a3b3991ac0c308a441/dsQTqtqf8SiM5oDe1FKFY.png
|
| 17 |
-
short_description:
|
|
|
|
|
|
|
| 18 |
---
|
| 19 |
|
| 20 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 21 |
|
| 22 |
-
Paper: https://huggingface.co/papers/2409.18839
|
|
|
|
| 3 |
emoji: 📚
|
| 4 |
colorFrom: purple
|
| 5 |
colorTo: blue
|
| 6 |
+
sdk: static
|
| 7 |
+
app_file: index.html
|
|
|
|
| 8 |
pinned: true
|
| 9 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
thumbnail: >-
|
| 11 |
https://cdn-uploads.huggingface.co/production/uploads/668f77a3b3991ac0c308a441/dsQTqtqf8SiM5oDe1FKFY.png
|
| 12 |
+
short_description: Embedded MinerU document extraction demo
|
| 13 |
+
fullWidth: true
|
| 14 |
+
header: mini
|
| 15 |
---
|
| 16 |
|
| 17 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 18 |
|
| 19 |
+
Paper: https://huggingface.co/papers/2409.18839
|
app.py
DELETED
|
@@ -1,42 +0,0 @@
|
|
| 1 |
-
# Copyright (c) Opendatalab. All rights reserved.
|
| 2 |
-
|
| 3 |
-
import os
|
| 4 |
-
import json
|
| 5 |
-
from loguru import logger
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
if __name__ == '__main__':
|
| 9 |
-
os.system('pip uninstall -y mineru')
|
| 10 |
-
os.system('pip install git+https://github.com/myhloli/Magic-PDF.git@dev')
|
| 11 |
-
os.system('pip install -U mineru_vl_utils')
|
| 12 |
-
os.system('pip uninstall -y onnxruntime')
|
| 13 |
-
os.system('pip install onnxruntime-gpu==1.23.2')
|
| 14 |
-
os.system('mineru-models-download -s huggingface -m all')
|
| 15 |
-
# os.system('mineru-models-download -s modelscope -m all')
|
| 16 |
-
os.environ['MINERU_MODEL_SOURCE'] = "local"
|
| 17 |
-
os.environ['GRADIO_SSR_MODE'] = "false"
|
| 18 |
-
os.environ['MINERU_PDF_RENDER_TIMEOUT'] = "10"
|
| 19 |
-
try:
|
| 20 |
-
home_dir = os.path.expanduser('~')
|
| 21 |
-
config_file = os.path.join(home_dir, 'mineru.json')
|
| 22 |
-
with open(config_file, 'r+') as file:
|
| 23 |
-
config = json.load(file)
|
| 24 |
-
|
| 25 |
-
delimiters = {
|
| 26 |
-
'display': {'left': '\\[', 'right': '\\]'},
|
| 27 |
-
'inline': {'left': '\\(', 'right': '\\)'}
|
| 28 |
-
}
|
| 29 |
-
|
| 30 |
-
config['latex-delimiter-config'] = delimiters
|
| 31 |
-
|
| 32 |
-
if os.getenv('apikey'):
|
| 33 |
-
config['llm-aided-config']['title_aided']['api_key'] = os.getenv('apikey')
|
| 34 |
-
config['llm-aided-config']['title_aided']['enable'] = True
|
| 35 |
-
config['llm-aided-config']['title_aided']['model'] = "qwen3.5-flash"
|
| 36 |
-
|
| 37 |
-
file.seek(0) # 将文件指针移回文件开始位置
|
| 38 |
-
file.truncate() # 截断文件,清除原有内容
|
| 39 |
-
json.dump(config, file, indent=4) # 写入新内容
|
| 40 |
-
except Exception as e:
|
| 41 |
-
logger.exception(e)
|
| 42 |
-
os.system('mineru-gradio --enable-api false --max-convert-pages 20 --latex-delimiters-type b --gpu-memory-utilization 0.5 --enable-vlm-preload true --client-side-output-generation true')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
index.html
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!doctype html>
|
| 2 |
+
<html lang="zh-CN">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="utf-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
| 6 |
+
<meta name="color-scheme" content="light dark">
|
| 7 |
+
<title>MinerU Document Extraction Tools</title>
|
| 8 |
+
<style>
|
| 9 |
+
html,
|
| 10 |
+
body {
|
| 11 |
+
width: 100%;
|
| 12 |
+
height: 100%;
|
| 13 |
+
margin: 0;
|
| 14 |
+
overflow: hidden;
|
| 15 |
+
background: #ffffff;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
iframe {
|
| 19 |
+
width: 100%;
|
| 20 |
+
height: 100vh;
|
| 21 |
+
min-height: 100vh;
|
| 22 |
+
border: 0;
|
| 23 |
+
display: block;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
noscript {
|
| 27 |
+
position: fixed;
|
| 28 |
+
inset: 0;
|
| 29 |
+
display: grid;
|
| 30 |
+
place-items: center;
|
| 31 |
+
padding: 24px;
|
| 32 |
+
font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
| 33 |
+
color: #1f2937;
|
| 34 |
+
background: #ffffff;
|
| 35 |
+
}
|
| 36 |
+
</style>
|
| 37 |
+
</head>
|
| 38 |
+
<body>
|
| 39 |
+
<iframe
|
| 40 |
+
src="https://opendatalab-mineru.ms.show"
|
| 41 |
+
title="MinerU Document Extraction Tools"
|
| 42 |
+
allow="clipboard-read; clipboard-write; fullscreen"
|
| 43 |
+
referrerpolicy="strict-origin-when-cross-origin"
|
| 44 |
+
></iframe>
|
| 45 |
+
<noscript>
|
| 46 |
+
当前页面需要启用 JavaScript 才能加载 MinerU 文档提取演示。
|
| 47 |
+
</noscript>
|
| 48 |
+
</body>
|
| 49 |
+
</html>
|
packages.txt
DELETED
|
@@ -1,2 +0,0 @@
|
|
| 1 |
-
fonts-noto-core
|
| 2 |
-
fonts-noto-cjk
|
|
|
|
|
|
|
|
|
requirements.txt
DELETED
|
@@ -1,2 +0,0 @@
|
|
| 1 |
-
mineru[core]>=3.2.0
|
| 2 |
-
vllm==0.21.0
|
|
|
|
|
|
|
|
|