From b4f9d4ddd051ce7999149ba0f48a52f4405b5582 Mon Sep 17 00:00:00 2001 From: hailin Date: Tue, 8 Jul 2025 09:32:14 +0800 Subject: [PATCH] . --- Dockerfile | 5 +++-- gradio_ui.py | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 gradio_ui.py diff --git a/Dockerfile b/Dockerfile index bc2dc83..487a2bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,7 @@ WORKDIR /app # 拷贝源码(包含 requirements 子目录) COPY evalscope.0.17.0/ ./evalscope +COPY gradio_ui.py . # 升级 pip 工具 RUN pip install --upgrade pip setuptools wheel @@ -32,5 +33,5 @@ RUN pip install \ -r ./evalscope/requirements/rag.txt && \ pip install -e ./evalscope -# 启动后输出 evalscope 总 help -ENTRYPOINT ["evalscope", "--help"] +# 启动 Gradio 服务 +CMD ["python3", "gradio_ui.py"] diff --git a/gradio_ui.py b/gradio_ui.py new file mode 100644 index 0000000..ad27eb2 --- /dev/null +++ b/gradio_ui.py @@ -0,0 +1,55 @@ +import gradio as gr + +def run_eval(inputs, native, other, outputs): + # 模拟输出,实际应拼接指令后调用 subprocess.run 或远程 API + result = ( + f"\n[Eval Started]\n" + f"Inputs: {inputs}\n" + f"Native Modules: {native}\n" + f"Other Backends: {other}\n" + f"Outputs: {outputs}\n" + f"[Eval Finished]" + ) + return result + +with gr.Blocks(title="EvalScope 全功能界面") as demo: + gr.Markdown("## EvalScope 功能选择平台") + + with gr.Row(): + with gr.Column(): + gr.Markdown("### INPUT 输入区") + input_choices = gr.CheckboxGroup( + label="选择输入源", + choices=["API Models", "Local Models", "Benchmarks", "Custom Datasets"] + ) + + with gr.Row(): + with gr.Column(): + gr.Markdown("### NATIVE 本地功能区") + native_choices = gr.CheckboxGroup( + label="启用本地模块", + choices=["Model Adapter", "Data Adapter", "Evaluator", "Perf Monitor"] + ) + + with gr.Column(): + gr.Markdown("### OTHER 其他功能区") + other_choices = gr.CheckboxGroup( + label="启用外部后端", + choices=["OpenCompass", "VLMEvalKit", "RAGAS", "MTEB/CMTEB"] + ) + + with gr.Row(): + with gr.Column(): + gr.Markdown("### OUTPUT 输出区") + output_choices = gr.CheckboxGroup( + label="输出形式", + choices=["Evaluation Report", "Gradio", "WandB", "Swanlab"] + ) + + run_button = gr.Button("Run Evaluation") + output_text = gr.Textbox(label="执行结果", lines=10) + + run_button.click(run_eval, inputs=[input_choices, native_choices, other_choices, output_choices], outputs=output_text) + +if __name__ == '__main__': + demo.launch(server_name="0.0.0.0", server_port=7900)