From 6e6591d106abc441c68a18d7316aa0ef775ec0b5 Mon Sep 17 00:00:00 2001 From: myhloli Date: Thu, 11 Jun 2026 10:35:58 +0800 Subject: [PATCH] feat: add model and paper links to header with popover menus for improved navigation --- mineru/cli/gradio_app.py | 15 ++++ mineru/resources/gradio_header.html | 107 +++++++++++++++++++++++++--- 2 files changed, 114 insertions(+), 8 deletions(-) diff --git a/mineru/cli/gradio_app.py b/mineru/cli/gradio_app.py index b00cd569..73e8835b 100644 --- a/mineru/cli/gradio_app.py +++ b/mineru/cli/gradio_app.py @@ -1309,7 +1309,12 @@ HEADER_I18N_PLACEHOLDERS = { "{{HEADER_STARS_ALT}}": "header_stars_alt", "{{HEADER_CODE_LINK}}": "header_code_link", "{{HEADER_MODEL_LINK}}": "header_model_link", + "{{HEADER_MODEL_HUGGINGFACE_LINK}}": "header_model_huggingface_link", + "{{HEADER_MODEL_MODELSCOPE_LINK}}": "header_model_modelscope_link", "{{HEADER_PAPER_LINK}}": "header_paper_link", + "{{HEADER_PAPER_MINERU_REPORT}}": "header_paper_mineru_report", + "{{HEADER_PAPER_MINERU25_REPORT}}": "header_paper_mineru25_report", + "{{HEADER_PAPER_MINERU25PRO_REPORT}}": "header_paper_mineru25pro_report", "{{HEADER_HOMEPAGE_LINK}}": "header_homepage_link", "{{HEADER_DOWNLOAD_LINK}}": "header_download_link", } @@ -1590,7 +1595,12 @@ def main(ctx, "header_stars_alt": "stars", "header_code_link": "Code", "header_model_link": "Model", + "header_model_huggingface_link": "Hugging Face", + "header_model_modelscope_link": "ModelScope", "header_paper_link": "Paper", + "header_paper_mineru_report": "MinerU · arXiv: 2409.18839", + "header_paper_mineru25_report": "MinerU 2.5 · arXiv: 2509.22186", + "header_paper_mineru25pro_report": "MinerU 2.5 Pro · arXiv: 2604.04771", "header_homepage_link": "Homepage", "header_download_link": "Download", "max_pages": "Max convert pages", @@ -1661,7 +1671,12 @@ def main(ctx, "header_stars_alt": "GitHub 星标", "header_code_link": "代码", "header_model_link": "模型", + "header_model_huggingface_link": "Hugging Face", + "header_model_modelscope_link": "ModelScope", "header_paper_link": "论文", + "header_paper_mineru_report": "MinerU · arXiv: 2409.18839", + "header_paper_mineru25_report": "MinerU 2.5 · arXiv: 2509.22186", + "header_paper_mineru25pro_report": "MinerU 2.5 Pro · arXiv: 2604.04771", "header_homepage_link": "主页", "header_download_link": "下载", "max_pages": "最大转换页数", diff --git a/mineru/resources/gradio_header.html b/mineru/resources/gradio_header.html index 44fb9fd1..73ec9c21 100644 --- a/mineru/resources/gradio_header.html +++ b/mineru/resources/gradio_header.html @@ -23,6 +23,80 @@ .external-link:hover { cursor: pointer !important; } + .mineru-header-menu { + position: relative; + } + .mineru-header-trigger { + appearance: none; + background: transparent !important; + border: 0; + border-color: transparent !important; + font: inherit; + } + .mineru-header-trigger:hover, + .mineru-header-trigger:focus, + .mineru-header-trigger:focus-visible, + .mineru-header-trigger:active { + background: transparent !important; + border-color: transparent !important; + color: #ffffff !important; + outline: none !important; + box-shadow: none !important; + } + .mineru-header-menu::after { + content: ""; + position: absolute; + left: 0; + right: 0; + top: 100%; + height: 12px; + } + .mineru-header-popover { + position: absolute; + left: 50%; + top: calc(100% + 10px); + z-index: 20; + width: 280px; + max-width: calc(100vw - 48px); + padding: 8px; + border: 1px solid rgba(255, 255, 255, 0.18); + border-radius: 8px; + background: rgba(17, 24, 39, 0.82); + backdrop-filter: blur(10px); + box-shadow: 0 12px 28px rgba(15, 23, 42, 0.28); + opacity: 0; + pointer-events: none; + transform: translate(-50%, 8px); + transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease; + visibility: hidden; + } + .mineru-model-popover { + width: 200px; + } + .mineru-header-menu:hover .mineru-header-popover, + .mineru-header-menu:focus-within .mineru-header-popover { + opacity: 1; + pointer-events: auto; + transform: translate(-50%, 0); + visibility: visible; + } + .mineru-header-popover-link { + display: block; + padding: 10px 12px; + border-radius: 6px; + color: rgba(255, 255, 255, 0.92) !important; + font-size: 14px; + line-height: 1.25; + text-align: left; + white-space: nowrap; + } + .mineru-header-popover-link:hover, + .mineru-header-popover-link:focus { + background: rgba(255, 255, 255, 0.12); + color: #ffffff !important; + outline: none; + text-decoration: none !important; + } a { text-decoration: none; } @@ -44,6 +118,14 @@ .mineru-demo-header .external-link:hover { text-decoration: none !important; } + .mineru-demo-header .mineru-header-popover, + .mineru-demo-header .mineru-header-popover * { + color: rgba(255, 255, 255, 0.92) !important; + } + .mineru-demo-header .mineru-header-popover-link:hover, + .mineru-demo-header .mineru-header-popover-link:focus { + color: #ffffff !important; + } @@ -110,23 +192,32 @@ {{HEADER_CODE_LINK}} - - - + + + + + {{HEADER_MODEL_HUGGINGFACE_LINK}} + {{HEADER_MODEL_MODELSCOPE_LINK}} + - - - + + + + + {{HEADER_PAPER_MINERU_REPORT}} + {{HEADER_PAPER_MINERU25_REPORT}} + {{HEADER_PAPER_MINERU25PRO_REPORT}} +