File size: 4,405 Bytes
73a9525 a266103 73a9525 1edab07 1aaa274 ca872a1 1edab07 4c24185 73a9525 1aaa274 c58f8c1 ed56ab7 1edab07 ed56ab7 4c24185 1aaa274 ed56ab7 4c24185 d6e3121 4c24185 c58f8c1 a266103 4c24185 a266103 8febd7d a266103 8febd7d a266103 8febd7d a266103 8febd7d a266103 8febd7d a266103 8febd7d a266103 1edab07 4c24185 c58f8c1 4c24185 c58f8c1 4c24185 c58f8c1 4c24185 c58f8c1 4c24185 c58f8c1 |
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
import streamlit as st
import pandas as pd
import datetime
from huggingface_hub import HfApi
import json
# 定义一些全局变量或参数
MAX_SUBMISSIONS_PER_DAY = 3 # 每天的最大提交次数
submissions_log = {} # 用于记录用户提交的次数
# 获取用户的唯一ID(使用Hugging Face的OAuth2身份验证)
def get_user_id():
api = HfApi()
user_info = api.whoami(token=st.secrets["hf_api_token"])
return user_info["name"]
# 检查用户当天的提交次数
def check_submission_limit(user_id):
today = datetime.date.today()
if user_id in submissions_log:
if submissions_log[user_id]["date"] == today:
return submissions_log[user_id]["count"] < MAX_SUBMISSIONS_PER_DAY
else:
submissions_log[user_id] = {"date": today, "count": 0}
return True
else:
submissions_log[user_id] = {"date": today, "count": 0}
return True
# 更新用户的提交记录
def update_submission_count(user_id):
submissions_log[user_id]["count"] += 1
# CSS样式
st.markdown("""
<style>
h1 {
font-size: 2.5em; /* 标题字体大小 */
}
.stDataFrame {
font-family: Helvetica;
}
.dataframe th, .dataframe td {
width: auto;
min-width: 500px;
}
</style>
""", unsafe_allow_html=True)
# 标题
st.title('🏆AEOLLM Leaderboard')
# 描述
st.markdown("""
This leaderboard is used to show the performance of the **automatic evaluation methods of LLMs** submitted by the **AEOLLM team** on four tasks:
- Summary Generation (SG)
- Non-Factoid QA (NFQA)
- Dialogue Generation (DG)
- Text Expansion (TE).
Details of AEOLLLM can be found at the link: [https://cjj826.github.io/AEOLLM/](https://cjj826.github.io/AEOLLM/)
Submit your result here (.json):
""", unsafe_allow_html=True)
# user_id = get_user_id()
# st.write(f"欢迎, {user_id}!")
# # 检查用户的提交限制
# if check_submission_limit(user_id):
# st.write(f"您今天还可以提交 {MAX_SUBMISSIONS_PER_DAY - submissions_log[user_id]['count']} 次。")
# # 创建文件上传组件
# uploaded_file = st.file_uploader("选择一个文件", type=["json"])
# # 创建一个按钮,用户点击后提交文件
# if st.button("提交文件"):
# if uploaded_file is not None:
# # 读取文件内容
# file_content = uploaded_file.read().decode("utf-8")
# # 如果是JSON文件,解析内容
# try:
# json_data = json.loads(file_content)
# st.success("文件已成功提交!")
# st.json(json_data) # 显示上传的JSON数据
# except json.JSONDecodeError:
# st.error("无法解析JSON文件,请确保文件格式正确。")
# else:
# st.warning("请先上传一个文件!")
# else:
# st.error("您今天的提交次数已达上限。请明天再试。")
# 创建示例数据
SG = {
"methods": ["Model A", "Model B", "Model C"],
"team": ["U1", "U2", "U3"],
"acc": [0.75, 0.64, 0.83],
"tau": [0.05, 0.28, 0.16],
"s": [0.12, 0.27, 0.18],
}
df1 = pd.DataFrame(SG)
NFQA = {
"methods": ["Model A", "Model B", "Model C"],
"team": ["U1", "U2", "U3"],
"acc": [0.75, 0.64, 0.83],
"tau": [0.05, 0.28, 0.16],
"s": [0.12, 0.27, 0.18]
}
df2 = pd.DataFrame(NFQA)
DG = {
"methods": ["Model A", "Model B", "Model C"],
"team": ["U1", "U2", "U3"],
"acc": [0.75, 0.64, 0.83],
"tau": [0.05, 0.28, 0.16],
"s": [0.12, 0.27, 0.18]
}
df3 = pd.DataFrame(DG)
TE = {
"methods": ["Model A", "Model B", "Model C"],
"team": ["U1", "U2", "U3"],
"acc": [0.75, 0.64, 0.83],
"tau": [0.05, 0.28, 0.16],
"s": [0.12, 0.27, 0.18]
}
df4 = pd.DataFrame(TE)
# 创建标签页
tab1, tab2, tab3, tab4 = st.tabs(["SG", "NFQA", "DG", "TE"])
# 在标签页 1 中添加内容
with tab1:
st.header("Summary Generation")
st.dataframe(df1, use_container_width=True)
# 在标签页 2 中添加内容
with tab2:
st.header("Non-Factoid QA")
st.dataframe(df2, use_container_width=True)
# 在标签页 3 中添加内容
with tab3:
st.header("Dialogue Generation")
st.dataframe(df3, use_container_width=True)
# 在标签页 4 中添加内容
with tab4:
st.header("Text Expansion")
st.dataframe(df4, use_container_width=True, )
|