Add report best results

This commit is contained in:
2023-06-06 00:59:10 +02:00
parent 0c1c226afe
commit eb8b0d3554
5 changed files with 55 additions and 7 deletions

Binary file not shown.

View File

@@ -7,7 +7,6 @@ from flask_login import current_user
from flask import Blueprint, current_app, send_file
from flask import render_template, current_app, request, redirect, url_for
from flask_login import login_required
from ..config import Config
# import shutil
# import xlsxwriter
@@ -76,11 +75,12 @@ def datasets():
@login_required
def best(file_name):
os.chdir(current_user.benchmark.folder)
dt = Datasets()
datos = []
for dataset in dt:
datos.append(dt.get_attributes(dataset))
return render_template("datasets.html", datasets=datos)
try:
with open(os.path.join(Folders.results, file_name)) as f:
data = json.load(f)
except Exception as e:
return render_template("error.html", message=str(e))
return render_template("best.html", data=data)
@results.route("/set_compare", methods=["POST"])

View File

@@ -0,0 +1,31 @@
{% extends "base.html" %}
{% block content %}
<table id="file-table"
class="table table-striped table-hover table-bordered bg-light">
<thead>
<tr class="bg-primary text-white">
<th class="text-center">Dataset</th>
<th class="text-center">Score</th>
<th class="text-center">Hyperparameters</th>
<th class="text-center">File</th>
</tr>
</thead>
<tbody>
{% for dataset, info in data.items() %}
<tr>
<td>{{ dataset }}</td>
<td class="text-end">{{ '%9.7f' % info[0] }}</td>
<td class="text-center">{{ info[1] }}</td>
<td>
{% set url = url_for(request.endpoint, **request.view_args)|urlencode %}
<a href="{{ url_for('results.report', file_name = info[2]) }}?url={{ url }}">{{ info[2] }}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
{% block jscript %}
{{ super() }}
<script src="{{ url_for('static', filename="js/report.js") }}"></script>
{% endblock %}

View File

@@ -4,5 +4,5 @@
{% endblock %}
{% block jscript %}
{{ super() }}
{#<script src="{{ url_for('static', filename="js/report.js") }}"></script>#}
<script src="{{ url_for('static', filename="js/report.js") }}"></script>
{% endblock %}

17
app/static/js/report.js Normal file
View File

@@ -0,0 +1,17 @@
$(document).ready(function () {
// Check if row is selected
$('#report-table tbody').on('click', 'tr', function () {
if ($(this).hasClass('selected')) {
$(this).removeClass('selected');
} else {
$('#report-table tbody tr.selected').removeClass("selected")
$(this).addClass('selected');
}
});
$(document).ajaxStart(function(){
$("body").addClass('ajaxLoading');
});
$(document).ajaxStop(function(){
$("body").removeClass('ajaxLoading');
});
});