Skip to content

Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.

fix: update file preview URL structure to use gradio_api for improved access

myhlolie10a87277a9f
diff --git a/mineru/cli/gradio_app.py b/mineru/cli/gradio_app.py
index 29507bb4..aa242b87 100644
--- a/mineru/cli/gradio_app.py
+++ b/mineru/cli/gradio_app.py
@@ -5,7 +5,6 @@ import os
import re
import sys
import time
-import urllib.parse
import zipfile
from pathlib import Path
@@ -264,9 +263,8 @@ def update_file_preview(file_path, request: gr.Request):
or request.headers.get('host', 'localhost:7860'))
proto = request.headers.get('x-forwarded-proto', 'http')
base_url = f"{proto}://{host}"
- public_url = f"{base_url}/file={file_path}"
- encoded_url = urllib.parse.quote(public_url, safe='')
- viewer_url = f"https://view.officeapps.live.com/op/embed.aspx?src={encoded_url}"
+ public_url = f"{base_url}/gradio_api/file={file_path}"
+ viewer_url = f"https://view.officeapps.live.com/op/embed.aspx?src={public_url}"
html_content = (
f'<iframe src="{viewer_url}" '
f'width="100%" height="800px" frameborder="0" '