File size: 904 Bytes
060799f
 
db69e73
060799f
db69e73
060799f
db69e73
060799f
 
 
 
 
db69e73
 
 
 
 
7b08134
 
db69e73
 
 
060799f
db69e73
 
 
 
 
 
060799f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import gradio as gr
import pandas as pd
from evaluate.visualization import radar_plot  # 正确模块

# 模拟的评分数据
scores = {
    "Model A": [4.0, 4.5, 3.5, 4.0],
    "Model B": [3.5, 4.0, 4.0, 3.5]
}
labels = ["Generalization", "Relevance", "Artistry", "Efficiency"]
df = pd.DataFrame(scores, index=labels).T

# 图表绘制函数
def plot_radar():
    data = []
    for model in df.index:
        data.append({label: df.loc[model, label] for label in df.columns})
    fig = radar_plot(data=data, model_names=list(df.index))
    fig.suptitle("GRACE 模型评估对比图", fontsize=14)
    return fig

# Gradio 界面构建
with gr.Blocks() as demo:
    gr.Markdown("## ✨ 模型 GRACE 维度雷达图")
    with gr.Row():
        generate_button = gr.Button("生成图表")
    output_plot = gr.Plot()
    generate_button.click(fn=plot_radar, inputs=[], outputs=output_plot)

demo.launch()