Spaces:
Running
Running
import gradio as gr | |
import pandas as pd | |
# 文件路径 | |
file_path1_1 = 'Generation.csv' | |
file_path1_2 = 'Revision.csv' | |
file_path1_3 = 'Safety& Responsibility.csv' | |
file_path2_1 = 'Alignment with Instruction.csv' | |
file_path2_2 = 'Image Integrity.csv' | |
file_path2_3 = 'Image Aesthetics.csv' | |
file_path3_1 = 'Alignment with Reference.csv' | |
file_path3_2 = 'Revision Image Integrity.csv' | |
file_path3_3 = 'Revision Image Aesthetics.csv' | |
dff1_1 = pd.read_csv(file_path1_1) | |
dff1_2 = pd.read_csv(file_path1_2) | |
dff1_3 = pd.read_csv(file_path1_3) | |
dff2_1 = pd.read_csv(file_path2_1) | |
dff2_2 = pd.read_csv(file_path2_2) | |
dff2_3 = pd.read_csv(file_path2_3) | |
dff3_1 = pd.read_csv(file_path3_1) | |
dff3_2 = pd.read_csv(file_path3_2) | |
dff3_3 = pd.read_csv(file_path3_3) | |
def display_table(table_choice): | |
if table_choice == "Option 1: New Image Generation Quality Ranking": | |
return dff1_1 | |
elif table_choice == "Option 2: Safety and Responsibility Ranking": | |
return dff1_3 | |
elif table_choice == "----Dimension 1-Alignment with Instruction": | |
return dff2_1 | |
elif table_choice == "----Dimension 2-Image Integrity": | |
return dff2_2 | |
elif table_choice == "----Dimension 3-Image Aesthetics": | |
return dff2_3 | |
def display_table2(table_choice): | |
if table_choice == "Image Revision Test Ranking": | |
return dff1_2 | |
elif table_choice == "----Dimension 1-Alignment with Reference": | |
return dff3_1 | |
elif table_choice == "----Dimension 2-Revised Image Integrity": | |
return dff3_2 | |
elif table_choice == "----Dimension 3-Revised Image Aesthetics": | |
return dff3_3 | |
with gr.Blocks() as demo: | |
gr.Markdown( | |
""" | |
# Evaluation of Image Generation Capabilities of Artificial Intelligence Models / 人工智能模型图像生成能力综合评测 | |
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> | |
<sup>1</sup>HKU Business School, <sup>2</sup>School of Management, Xi'an Jiaotong University<br> | |
For access to the full research report, please contact Prof. Jiang at jiangz@hku.hk. | |
""" | |
) | |
with gr.Tab("🎨New Img Generation"): | |
with gr.Column(): | |
dropdown = gr.Dropdown(choices=["Option 1: New Image Generation Quality Ranking", | |
"----Dimension 1-Alignment with Instruction", | |
"----Dimension 2-Image Integrity", | |
"----Dimension 3-Image Aesthetics", | |
"Option 2: Safety and Responsibility Ranking"], | |
label="Select a Leaderboard", | |
value="Option 1: New Image Generation Quality Ranking") | |
output = gr.DataFrame(value=dff1_1, max_height =900) | |
dropdown.change(fn=display_table, inputs=dropdown, outputs=output) | |
with gr.Tab("🖼️Img Revision"): | |
with gr.Column(): | |
dropdown2 = gr.Dropdown(choices=["Image Revision Test Ranking", "----Dimension 1-Alignment with Reference", | |
"----Dimension 2-Revised Image Integrity", | |
"----Dimension 3-Revised Image Aesthetics"], | |
label="Select a Leaderboard", | |
value="Image Revision Test Ranking") | |
output2 = gr.DataFrame(value=dff1_2, max_height =900) | |
dropdown2.change(fn=display_table2, inputs=dropdown2, outputs=output2) | |
demo.launch() |