File size: 1,436 Bytes
b845998
146b688
 
ea2d6ae
b14be2c
ea2d6ae
146b688
 
b845998
146b688
f7e9cda
 
 
ca60da9
 
 
 
 
 
 
 
 
 
 
b845998
 
 
 
 
 
 
146b688
 
 
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
from flask import Flask, render_template, url_for
import pandas as pd

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, '#', '')

    df = df.rename(columns={
        "Ordinal (Win rate)": "Ordinal (Win rate) (+)",
        "Cardinal (Score)": "Cardinal (Score) (+)",
        "RO Stability": "RO Stability (+)",
        "Rank Distance": "Rank Distance (-)",
        "CFI": "CFI (+)",
        "SRMR": "SRMR (-)",
        "RMSEA": "RMSEA (-)",
        "Cronbach alpha": "Cronbach alpha (+)"
    })

    # Generate the table HTML with clickable model names
    table_html = df.to_html(classes='table table-striped table-bordered', escape=False, index=False)

    # Modify the table HTML to add links to model names
    for model in df['Model']:
        model_link = f'<a href="{url_for("model_detail", model_name=model)}">{model}</a>'
        table_html = table_html.replace(f'>{model}<', f'>{model_link}<')

    # Render the template with the table HTML
    return render_template('index.html', table_html=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)