File size: 1,866 Bytes
40c29ba 146b688 40c29ba 146b688 ea2d6ae b14be2c 40c29ba ea2d6ae 146b688 b845998 146b688 f7e9cda 40c29ba ca60da9 40c29ba ca60da9 40c29ba b845998 40c29ba 146b688 40c29ba b14be2c b845998 b42419d ea2d6ae |
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 |
from flask import Flask, render_template
import pandas as pd
import utils
app = Flask(__name__)
@app.route('/')
def index():
# Load the CSV file into a DataFrame
df = pd.read_csv('static/leaderboard.csv')
df = df.round(3)
df.insert(0, '#', '')
# up_arrow, down_arrow = "⬆️", "⬇️"
up_arrow, down_arrow = "↑", "↓"
# up_arrow, down_arrow = "▲", "▼"
df = df.rename(columns={
"Ordinal (Win rate)": f"Ordinal - Win rate ({up_arrow})",
"Cardinal (Score)": f"Cardinal - Score ({up_arrow})",
"RO Stability": f"RO Stability ({up_arrow})",
"Stress": f"Stress ({down_arrow})",
"Rank Distance": f"Rank Distance ({down_arrow})",
"Separability": f"Separability ({up_arrow})",
"CFI": f"CFI ({up_arrow})",
"SRMR": f"SRMR ({down_arrow})",
"RMSEA": f"RMSEA ({down_arrow})",
"Cronbach alpha": f"Cronbach alpha ({up_arrow})"
})
# Generate full table HTML with clickable model names
################
main_table_metrics = [
"#",
"Model",
f"Ordinal - Win rate ({up_arrow})",
f"Cardinal - Score ({up_arrow})",
f"RO Stability ({up_arrow})"
]
main_df = df[main_table_metrics].copy()
main_table_html = utils.df_to_table_html(main_df, additional_class="main-table")
full_table_html = utils.df_to_table_html(df, additional_class="full-table")
# Render the template with the table HTML
return render_template('index.html', main_table_html=main_table_html, full_table_html=full_table_html)
@app.route('/model/<model_name>')
def model_detail(model_name):
return render_template('model_detail.html', model_name=model_name)
@app.route('/about')
def about():
return render_template('about.html')
if __name__ == '__main__':
app.run(host='0.0.0.0', port=7860, debug=True)
|