Begin adding sockets

This commit is contained in:
2023-06-09 22:27:09 +02:00
parent bba590c0a5
commit 9c43e2721a
13 changed files with 269 additions and 53 deletions

View File

@@ -1,18 +1,16 @@
import json
import os
import shutil
from pathlib import Path
import xlsxwriter
from benchmark.Datasets import Datasets
from benchmark.ResultsBase import StubReport
from benchmark.ResultsFiles import Benchmark, Excel, ReportDatasets
from benchmark.ResultsFiles import Excel, ReportDatasets
from benchmark.Utils import Files, Folders
from dotenv import dotenv_values
from flask import (
Blueprint,
current_app,
redirect,
render_template,
request,
send_file,
@@ -20,8 +18,6 @@ from flask import (
)
from flask_login import current_user, login_required
from .forms import RankingForm
results = Blueprint("results", __name__, template_folder="templates")
@@ -235,32 +231,3 @@ def dataset_report(dataset):
results=results,
app_config=app_config,
)
@results.route("/ranking", methods=["GET", "POST"])
@login_required
def ranking():
os.chdir(current_user.benchmark.folder)
form = RankingForm()
if form.validate_on_submit():
benchmark = Benchmark(score=form.score.data, visualize=False)
try:
benchmark.compile_results()
benchmark.save_results()
benchmark.report(tex_output=False)
benchmark.exreport()
benchmark.excel()
except ValueError as e:
return render_template(
"error.html", message="Couldn't generate ranking", error=str(e)
)
except KeyError as e:
return render_template(
"error.html",
message="Couldn't generate ranking. It seems that there are "
"partial results for some classifiers",
error=f"Key not found {str(e)}",
)
file_name = Path(benchmark.get_excel_file_name()).name
return redirect(url_for("results.download", file_name=file_name))
return render_template("ranking.html", form=form)