From 85d16ef782ad442e82522db4fae64fc918bdf399 Mon Sep 17 00:00:00 2001 From: hailin Date: Tue, 8 Jul 2025 10:47:00 +0800 Subject: [PATCH] . --- gradio_ui.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/gradio_ui.py b/gradio_ui.py index b92a7c5..7fde4e9 100644 --- a/gradio_ui.py +++ b/gradio_ui.py @@ -19,7 +19,7 @@ def enforce_input_exclusive_and_toggle_fields(selected): def keep_only_one(group): filtered = [item for item in selected if item in group] - return filtered[-1:] # 只保留最后一个 + return filtered[-1:] # 保留最后一个 final_selection = set(selected) final_selection -= group1 @@ -32,8 +32,7 @@ def enforce_input_exclusive_and_toggle_fields(selected): return ( gr.update(value=list(final_selection)), - gr.update(visible=show_api_fields), - gr.update(visible=show_api_fields) + gr.Row.update(visible=show_api_fields) # ✅ 用 Row 的更新 ) with gr.Blocks(title="EvalScope 全功能界面") as demo: @@ -71,16 +70,23 @@ with gr.Blocks(title="EvalScope 全功能界面") as demo: run_button = gr.Button("Run Evaluation") output_text = gr.Textbox(label="执行结果", lines=10) - # 绑定输入源选择的变化,控制互斥+是否显示API字段 + # ✅ 绑定变化,更新互斥选项与 API 表单显示 input_choices.change( fn=enforce_input_exclusive_and_toggle_fields, inputs=input_choices, - outputs=[input_choices, api_url_input, api_token_input] + outputs=[input_choices, api_fields] ) run_button.click( run_eval, - inputs=[input_choices, native_choices, other_choices, output_choices, api_url_input, api_token_input], + inputs=[ + input_choices, + native_choices, + other_choices, + output_choices, + api_url_input, + api_token_input + ], outputs=output_text )