This commit is contained in:
parent
c48ad6ca73
commit
013f4602de
54
gradio_ui.py
54
gradio_ui.py
|
|
@ -18,11 +18,6 @@ def run_eval(
|
|||
max_prompt_len, num_requests,
|
||||
model_override
|
||||
):
|
||||
"""
|
||||
1. 动态拼装 evalscope perf 命令
|
||||
2. 流式打印日志
|
||||
3. (可选)启动可视化报告
|
||||
"""
|
||||
global current_process
|
||||
|
||||
timestamp = time.strftime("%Y%m%d-%H%M%S")
|
||||
|
|
@ -67,7 +62,6 @@ def run_eval(
|
|||
|
||||
full_output += "[Eval Finished]\n"
|
||||
|
||||
# ---------- 可视化报告 ----------
|
||||
if "Evaluation Report" in output_choices:
|
||||
vis_port = 7861
|
||||
outputs_root = "./outputs"
|
||||
|
|
@ -153,13 +147,9 @@ def enforce_input_exclusive_and_toggle_fields(selected):
|
|||
input_update = gr.update() if list(selected) == final_list else gr.update(value=final_list)
|
||||
|
||||
show_api_fields = "API Models" in final_sel
|
||||
api_row_update = gr.Row.update(visible=show_api_fields)
|
||||
api_field_update = gr.Column.update(visible=show_api_fields)
|
||||
|
||||
show_run_params = bool(final_sel & {"API Models", "Local Models"})
|
||||
# 👇 修复:用通用 gr.update 而非 Column.update
|
||||
run_params_update = gr.update(visible=show_run_params)
|
||||
|
||||
return input_update, api_row_update, run_params_update
|
||||
return input_update, api_field_update
|
||||
|
||||
|
||||
# ---------------- 构建 Gradio UI ----------------
|
||||
|
|
@ -171,13 +161,12 @@ with gr.Blocks(title="EvalScope 全功能界面") as demo:
|
|||
with gr.Row():
|
||||
input_choices = gr.CheckboxGroup(
|
||||
label="选择输入源",
|
||||
choices=["API Models", "Local Models",
|
||||
"Benchmarks", "Custom Datasets"],
|
||||
choices=["API Models", "Local Models", "Benchmarks", "Custom Datasets"],
|
||||
interactive=True
|
||||
)
|
||||
|
||||
# ===== API 地址 & Token =====
|
||||
with gr.Row(visible=False) as api_fields:
|
||||
# ===== API 地址 & 运行参数(统一控制显示) =====
|
||||
with gr.Column(visible=False) as api_fields:
|
||||
api_url_input = gr.Textbox(
|
||||
label="API 地址",
|
||||
placeholder="https://api.example.com/v1/chat"
|
||||
|
|
@ -187,24 +176,6 @@ with gr.Blocks(title="EvalScope 全功能界面") as demo:
|
|||
type="password",
|
||||
placeholder="sk-xxx"
|
||||
)
|
||||
|
||||
# ===== 本地/外部组件 =====
|
||||
with gr.Row():
|
||||
with gr.Column():
|
||||
native_choices = gr.CheckboxGroup(
|
||||
label="启用本地模块",
|
||||
choices=["Model Adapter", "Data Adapter",
|
||||
"Evaluator", "Perf Monitor"]
|
||||
)
|
||||
with gr.Column():
|
||||
other_choices = gr.CheckboxGroup(
|
||||
label="启用外部后端",
|
||||
choices=["OpenCompass", "VLMEvalKit",
|
||||
"RAGAS", "MTEB/CMTEB"]
|
||||
)
|
||||
|
||||
# ===== 运行参数(可隐藏) =====
|
||||
with gr.Column(visible=False) as run_params_section:
|
||||
with gr.Accordion("运行参数(可选修改)", open=False):
|
||||
with gr.Row():
|
||||
api_provider_dropdown = gr.Dropdown(
|
||||
|
|
@ -244,6 +215,19 @@ with gr.Blocks(title="EvalScope 全功能界面") as demo:
|
|||
minimum=2048, maximum=32768, step=512, value=15360
|
||||
)
|
||||
|
||||
# ===== 本地/外部组件 =====
|
||||
with gr.Row():
|
||||
with gr.Column():
|
||||
native_choices = gr.CheckboxGroup(
|
||||
label="启用本地模块",
|
||||
choices=["Model Adapter", "Data Adapter", "Evaluator", "Perf Monitor"]
|
||||
)
|
||||
with gr.Column():
|
||||
other_choices = gr.CheckboxGroup(
|
||||
label="启用外部后端",
|
||||
choices=["OpenCompass", "VLMEvalKit", "RAGAS", "MTEB/CMTEB"]
|
||||
)
|
||||
|
||||
# ===== 输出形式 =====
|
||||
output_choices = gr.CheckboxGroup(
|
||||
label="输出形式",
|
||||
|
|
@ -263,7 +247,7 @@ with gr.Blocks(title="EvalScope 全功能界面") as demo:
|
|||
input_choices.change(
|
||||
fn=enforce_input_exclusive_and_toggle_fields,
|
||||
inputs=input_choices,
|
||||
outputs=[input_choices, api_fields, run_params_section]
|
||||
outputs=[input_choices, api_fields]
|
||||
)
|
||||
|
||||
run_button.click(
|
||||
|
|
|
|||
Loading…
Reference in New Issue