evalscope_v0.17.0/gradio_ui.py

57 lines
1.9 KiB
Python

import gradio as gr
def run_eval(inputs, native, other, outputs):
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.Group():
gr.Markdown("### INPUT 输入区")
with gr.Row():
input_choices = gr.CheckboxGroup(
label="选择输入源",
choices=["API Models", "Local Models", "Benchmarks", "Custom Datasets"]
)
with gr.Row():
with gr.Column():
with gr.Group():
gr.Markdown("### NATIVE 本地功能区")
native_choices = gr.CheckboxGroup(
label="启用本地模块",
choices=["Model Adapter", "Data Adapter", "Evaluator", "Perf Monitor"]
)
with gr.Column():
with gr.Group():
gr.Markdown("### OTHER 其他功能区")
other_choices = gr.CheckboxGroup(
label="启用外部后端",
choices=["OpenCompass", "VLMEvalKit", "RAGAS", "MTEB/CMTEB"]
)
with gr.Group():
gr.Markdown("### OUTPUT 输出区")
with gr.Row():
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)