mirror of
https://github.com/Doctorado-ML/beflask.git
synced 2025-08-16 07:35:51 +00:00
Add report best results
This commit is contained in:
BIN
app/app.db
BIN
app/app.db
Binary file not shown.
@@ -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"])
|
||||
|
31
app/results/templates/best.html
Normal file
31
app/results/templates/best.html
Normal 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 %}
|
@@ -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
17
app/static/js/report.js
Normal 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');
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user