|
from flask import Flask, render_template, url_for |
|
import pandas as pd |
|
|
|
app = Flask(__name__) |
|
|
|
@app.route('/') |
|
def index(): |
|
|
|
df = pd.read_csv('static/leaderboard.csv') |
|
|
|
df = df.round(3) |
|
df.insert(0, '#', '') |
|
|
|
|
|
table_html = df.to_html(classes='table table-striped table-bordered', escape=False, index=False) |
|
|
|
|
|
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}<') |
|
|
|
|
|
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) |
|
|
|
if __name__ == '__main__': |
|
app.run(host='0.0.0.0', port=7860, debug=True) |
|
|