Demo / pages /LeaderBoard.py
HuskyDoge's picture
fixed some bugs
6b8ff79
raw
history blame
489 Bytes
import streamlit as st
# 示例数据
data = {
"Player": ["Alice", "Bob", "Charlie"],
"Score": [100, 95, 90]
}
# 将数据转换为 Markdown 格式的字符串
def create_leaderboard(data):
leaderboard = "### Leaderboard\n"
for i, (player, score) in enumerate(zip(data["Player"], data["Score"]), start=1):
leaderboard += f"{i}. **{player}**: {score} points\n"
return leaderboard
# 在 Streamlit 应用中显示排行榜
st.markdown(create_leaderboard(data))