x
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# --- WebUI 前端(纯前端,通过 nginx 分发到 worker)---
|
# --- WebUI 前端 ---
|
||||||
gradio:
|
gradio:
|
||||||
image: mineru-rocm:7.2.1
|
image: mineru-rocm:7.2.1
|
||||||
profiles: ["gradio"]
|
profiles: ["gradio"]
|
||||||
@@ -16,15 +16,30 @@ services:
|
|||||||
ipc: host
|
ipc: host
|
||||||
ports:
|
ports:
|
||||||
- "10002:7860"
|
- "10002:7860"
|
||||||
|
devices:
|
||||||
|
- /dev/kfd
|
||||||
|
- /dev/dri
|
||||||
|
security_opt:
|
||||||
|
- seccomp=unconfined
|
||||||
|
group_add:
|
||||||
|
- video
|
||||||
environment:
|
environment:
|
||||||
- GRADIO_SERVER_NAME=0.0.0.0
|
- GRADIO_SERVER_NAME=0.0.0.0
|
||||||
- GRADIO_TEMP_DIR=/tmp/gradio
|
- PYTHONPATH=/opt/vllm:${PYTHONPATH:-}
|
||||||
- MINERU_API_BASE=http://mineru-nginx:8000
|
- MINERU_MODEL_SOURCE=${MINERU_MODEL_SOURCE:-huggingface}
|
||||||
|
- HF_HUB_CACHE=${HF_HUB_CACHE:-/opt/models/huggingface}
|
||||||
|
- MODELSCOPE_CACHE=${MODELSCOPE_CACHE:-/opt/models/modelscope}
|
||||||
volumes:
|
volumes:
|
||||||
|
- ${INPUT_DIR:-./data/input}:/data/input:ro
|
||||||
|
- ${OUTPUT_DIR:-./data/output}:/data/output
|
||||||
|
- ${MODEL_DIR:-./data/models}:/opt/models
|
||||||
|
- ${MIOPEN_CACHE:-./data/miopen}:/root/.cache/miopen
|
||||||
- ./scripts:/opt/scripts:ro
|
- ./scripts:/opt/scripts:ro
|
||||||
command:
|
command:
|
||||||
[
|
[
|
||||||
"/opt/mineru_venv/bin/python", "/opt/scripts/mineru_webui.py",
|
"mineru-gradio",
|
||||||
|
"--server-name", "0.0.0.0",
|
||||||
|
"--server-port", "7860",
|
||||||
]
|
]
|
||||||
depends_on:
|
depends_on:
|
||||||
- nginx
|
- nginx
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ def create_ui():
|
|||||||
|
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
with gr.Column(scale=1):
|
with gr.Column(scale=1):
|
||||||
file_input = gr.File(
|
file_input = gr.UploadButton(
|
||||||
label="Upload PDF",
|
label="Upload PDF",
|
||||||
file_types=[".pdf"],
|
file_types=[".pdf"],
|
||||||
type="binary",
|
type="binary",
|
||||||
@@ -242,11 +242,16 @@ def create_ui():
|
|||||||
elem_classes=["result-panel"],
|
elem_classes=["result-panel"],
|
||||||
)
|
)
|
||||||
|
|
||||||
submit_btn.click(
|
file_input.upload(
|
||||||
fn=process_pdf,
|
fn=process_pdf,
|
||||||
inputs=[file_input, backend_dd, lang_dd],
|
inputs=[file_input, backend_dd, lang_dd],
|
||||||
outputs=[result_display, status_display, zip_display],
|
outputs=[result_display, status_display, zip_display],
|
||||||
)
|
)
|
||||||
|
submit_btn.click(
|
||||||
|
fn=lambda f,b,l: "Please use the Upload button above.",
|
||||||
|
inputs=[file_input, backend_dd, lang_dd],
|
||||||
|
outputs=[result_display, status_display, zip_display],
|
||||||
|
)
|
||||||
|
|
||||||
return demo
|
return demo
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user