CathieDaDa commited on
Commit
078a76a
·
verified ·
1 Parent(s): b819117

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -103
app.py CHANGED
@@ -25,119 +25,48 @@ dff3_2 = pd.read_csv(file_path3_2)
25
  dff3_3 = pd.read_csv(file_path3_3)
26
 
27
 
28
- # 返回处理后的 DataFrame
29
- def show_leaderboard1_1():
30
- return dff1_1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
- def show_leaderboard1_2():
33
- return dff1_2
34
-
35
- def show_leaderboard1_3():
36
- return dff1_3
37
-
38
- def show_leaderboard2_1():
39
- return dff2_1
40
-
41
- def show_leaderboard2_2():
42
- return dff2_2
43
-
44
- def show_leaderboard2_3():
45
- return dff2_3
46
-
47
- def show_leaderboard3_1():
48
- return dff3_1
49
-
50
- def show_leaderboard3_2():
51
- return dff3_2
52
-
53
- def show_leaderboard3_3():
54
- return dff3_3
55
-
56
-
57
-
58
- # Gradio 界面
59
  with gr.Blocks() as demo:
60
  gr.Markdown(
61
  """
62
- # Evaluation of 图像生成能力综合排名 of Artificial Intelligence Models / 人工智能模型图像生成能力综合评测
63
  by Zhenhui (Jack) Jiang<sup>1</sup>, Zhengyu Wu<sup>1</sup>, Jiaxin Li<sup>1</sup>, Haozhe Xu<sup>2</sup>, Yifan Wu<sup>1</sup>,Yi Lu<sup>1</sup>/ 蒋镇辉<sup>1</sup>,武正昱<sup>1</sup>,李佳欣<sup>1</sup>,徐昊哲<sup>2</sup>,吴轶凡<sup>1</sup>,鲁艺<sup>1</sup><br>
64
  <sup>1</sup>HKU Business School, <sup>2</sup>Shool of Management, Xi'an Jiaotong University<br>
65
  For access to the full research report, please contact Prof. Jiang at jiangz@hku.hk.
66
  """
67
  )
68
 
69
- with gr.Tab("Image Generation Test Ranking"):
70
- with gr.Column():
71
- gr.DataFrame(
72
- value=show_leaderboard1_1(),
73
- interactive=False,
74
- wrap=True
75
- )
76
-
77
- with gr.Tab("Image Revision Test Ranking"):
78
- with gr.Column():
79
- gr.DataFrame(
80
- value=show_leaderboard1_2(),
81
- interactive=False,
82
- wrap=True
83
- )
84
-
85
 
86
- with gr.Tab("Safety and Responsibility Ranking"):
87
- with gr.Column():
88
- gr.DataFrame(
89
- value=show_leaderboard1_3(),
90
- interactive=False,
91
- wrap=True
92
- )
93
-
94
- with gr.Tab("Rankings of Image Generation Task by Dimension"):
95
- with gr.Row():
96
- with gr.Column():
97
- gr.Markdown("### **Alignment with Instruction**")
98
- gr.DataFrame(
99
- value=show_leaderboard2_1(),
100
- interactive=False,
101
- wrap=True
102
- )
103
- with gr.Column():
104
- gr.Markdown("### **Image Integrity**")
105
- gr.DataFrame(
106
- value=show_leaderboard2_2(),
107
- interactive=False,
108
- wrap=True
109
- )
110
- with gr.Column():
111
- gr.Markdown("### **Image Aesthetics**")
112
- gr.DataFrame(
113
- value=show_leaderboard2_3(),
114
- interactive=False,
115
- wrap=True
116
- )
117
-
118
- with gr.Tab("Rankings of Image Revision Task by Dimension"):
119
- with gr.Row():
120
- with gr.Column():
121
- gr.Markdown("### **Alignment with Reference**")
122
- gr.DataFrame(
123
- value=show_leaderboard3_1(),
124
- interactive=False,
125
- wrap=True
126
- )
127
- with gr.Column():
128
- gr.Markdown("### **Image Integrity**")
129
- gr.DataFrame(
130
- value=show_leaderboard3_2(),
131
- interactive=False,
132
- wrap=True
133
- )
134
- with gr.Column():
135
- gr.Markdown("### **Image Aesthetics**")
136
- gr.DataFrame(
137
- value=show_leaderboard3_3(),
138
- interactive=False,
139
- wrap=True
140
- )
141
 
 
 
142
 
143
- demo.launch(share=True)
 
 
25
  dff3_3 = pd.read_csv(file_path3_3)
26
 
27
 
28
+ # 定义一个函数,根据用户选择的表格返回相应的表格
29
+ def display_table(table_choice):
30
+ if table_choice == "Image Generation Test Ranking":
31
+ return dff1_1
32
+ elif table_choice == "Image Revision Test Ranking":
33
+ return dff1_2
34
+ elif table_choice == "Safety and Responsibility Ranking":
35
+ return dff1_3
36
+ elif table_choice == "Rankings of Image Generation Task by Dimensio-Alignment with Instruction":
37
+ return dff2_1
38
+ elif table_choice == "Rankings of Image Generation Task by Dimension-Image Integrity":
39
+ return dff2_2
40
+ elif table_choice == "Rankings of Image Generation Task by Dimension-Image Aesthetics":
41
+ return dff2_3
42
+ elif table_choice == "Rankings of Image Revision Task by Dimension-Alignment with Reference":
43
+ return dff3_1
44
+ elif table_choice == "Rankings of Image Revision Task by Dimension-Image Integrity":
45
+ return dff3_2
46
+ elif table_choice == "Rankings of Image Revision Task by Dimension-Image Aesthetics":
47
+ return dff3_3
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  with gr.Blocks() as demo:
50
  gr.Markdown(
51
  """
52
+ # Evaluation of Image Generation Capabilities of Artificial Intelligence Models / 人工智能模型图像生成能力综合评测
53
  by Zhenhui (Jack) Jiang<sup>1</sup>, Zhengyu Wu<sup>1</sup>, Jiaxin Li<sup>1</sup>, Haozhe Xu<sup>2</sup>, Yifan Wu<sup>1</sup>,Yi Lu<sup>1</sup>/ 蒋镇辉<sup>1</sup>,武正昱<sup>1</sup>,李佳欣<sup>1</sup>,徐昊哲<sup>2</sup>,吴轶凡<sup>1</sup>,鲁艺<sup>1</sup><br>
54
  <sup>1</sup>HKU Business School, <sup>2</sup>Shool of Management, Xi'an Jiaotong University<br>
55
  For access to the full research report, please contact Prof. Jiang at jiangz@hku.hk.
56
  """
57
  )
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
+ with gr.Row():
61
+ dropdown = gr.Dropdown(choices=["Option 1: Image Generation Test Ranking", "Option 2: Image Revision Test Ranking", "Option 3: Safety and Responsibility Ranking","Option 4: Rankings of Image Generation Task by Dimensio-Alignment with Instruction","Option 5: Rankings of Image Generation Task by Dimension-Image Integrity","Option 6: Rankings of Image Generation Task by Dimension-Image Aesthetics","Option 7: Rankings of Image Revision Task by Dimension-Alignment with Reference","Option 8: Rankings of Image Revision Task by Dimension-Image Integrity","Option 9: Rankings of Image Revision Task by Dimension-Image Aesthetics"],
62
+ label="### **Select a Leaderboard**",
63
+ value="Image Generation Test Ranking") # 设置默认值为"Table 1"
64
+
65
+ with gr.Row():
66
+ output = gr.DataFrame(value=dff1_1) # 设置初始值为table_1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
+ # 通过更新函数实现交互
69
+ dropdown.change(fn=display_table, inputs=dropdown, outputs=output)
70
 
71
+ # 启动Gradio界面
72
+ demo.launch()