diff --git a/senpy/static/js/main.js b/senpy/static/js/main.js
index b6933ed..2499149 100644
--- a/senpy/static/js/main.js
+++ b/senpy/static/js/main.js
@@ -316,13 +316,27 @@ function get_datasets_from_checkbox(){
}
+function create_body_metrics(evaluations){
+ var new_tbody = document.createElement('tbody')
+ var metric_html = ""
+ for (var eval in evaluations){
+ metric_html += "
"+evaluations[eval].evaluates+" | "+evaluations[eval].evaluatesOn+" | ";
+ for (var metric in evaluations[eval].metrics){
+ metric_html += ""+parseFloat(evaluations[eval].metrics[metric].value.toFixed(4))+" | ";
+ }
+ metric_html += "
";
+ }
+ new_tbody.innerHTML = metric_html
+ return new_tbody
+}
+
function evaluate_JSON(){
url = "/api/evaluate";
var container = document.getElementById('results_eval');
var rawcontainer = document.getElementById('jsonraw_eval');
- var table = document.getElementById("evaluation-table");
+ var table = document.getElementById("eval_table");
rawcontainer.innerHTML = "";
container.innerHTML = "";
@@ -345,25 +359,18 @@ function evaluate_JSON(){
mode: 'view'
};
- var metric_html = "";
- metric_html += "Plugin | Dataset | Accuracy | Precision_macro | Recall_macro | F1_macro | F1_weighted | F1_micro | F1 |
";
-
+ //Control the single response results
if (!(Array.isArray(response.evaluations))){
response.evaluations = [response.evaluations]
}
- for (var eval in response.evaluations){
- metric_html += ""+response.evaluations[eval].evaluates+" | "+response.evaluations[eval].evaluatesOn+" | ";
- for (var metric in response.evaluations[eval].metrics){
- metric_html += ""+parseFloat(response.evaluations[eval].metrics[metric].value.toFixed(4))+" | ";
- }
- metric_html += "
";
- }
- table.innerHTML = metric_html;
+
+ new_tbody = create_body_metrics(response.evaluations)
+ table.replaceChild(new_tbody, table.lastElementChild)
var editor = new JSONEditor(container, options, response);
editor.expandAll();
// $('#results-div a[href="#viewer"]').tab('show');
- $('#evaluate-div a[href="#evaluate-viewer"]').click();
+ $('#evaluate-div a[href="#evaluate-table"]').click();
// location.hash = 'raw';
diff --git a/senpy/templates/index.html b/senpy/templates/index.html
index bae9e91..5d7e4f4 100755
--- a/senpy/templates/index.html
+++ b/senpy/templates/index.html
@@ -178,7 +178,7 @@ I cannot believe it!
@@ -194,10 +194,27 @@ I cannot believe it!
-
+
+
+
+ Plugin |
+ Dataset |
+ Accuracy |
+ Precision_macro |
+ Recall_macro |
+ F1_macro |
+ F1_weighted |
+ F1_micro |
+ F1 |
+
+
+
+
+
-
+
+