Commit d4e31f11 authored by Chris's avatar Chris
Browse files

Top 5 algorithms will load from the server when it's ready

parent caebb8e9
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@
    <title>Spam Hunter</title>

    <!-- Meat 'n potatoes -->
    <body>
    <body onload="getTopFiveAlgorithms()">
        <div id="interactivity" class="jumbotron">
            <!-- User interactivity portion -->
            <h3>Type your message here:</h3>
@@ -46,24 +46,24 @@

                <tbody>
                    <tr>
                        <td>Neural Network</td>
                        <td>1.0</td>
                        <td id="alg1_name">Neural Network</td>
                        <td id="alg1_f1">1.0</td>
                    </tr>
                    <tr>
                        <td>Neural Network</td>
                        <td>1.0</td>
                        <td id="alg2_name">Neural Network</td>
                        <td id="alg2_f1">1.0</td>
                    </tr>
                    <tr>
                        <td>Neural Network</td>
                        <td>1.0</td>
                        <td id="alg3_name">Neural Network</td>
                        <td id="alg3_f1">1.0</td>
                    </tr>
                    <tr>
                        <td>Neural Network</td>
                        <td>1.0</td>
                        <td id="alg4_name">Neural Network</td>
                        <td id="alg4_f1">1.0</td>
                    </tr>
                    <tr>
                        <td>Neural Network</td>
                        <td>1.0</td>
                        <td id="alg5_name">Neural Network</td>
                        <td id="alg5_f1">1.0</td>
                    </tr>
                </tbody>

+22 −1
Original line number Diff line number Diff line
@@ -18,7 +18,9 @@ function getPrediction() {

            document.getElementById("prediction").innerText = replyObj.prediction;  // signifies that we need a string called prediction from the backend
        }

        else {
            console.log("Error getting prediction from the backend server. (Is it running?)");
        }
    }
}

@@ -42,8 +44,27 @@ function getTopFiveAlgorithms() {
            replyObj = JSON.parse(replyString);

            // put the algorithm names in their ranked order
            document.getElementById("alg1_name").innerText = replyObj.name[0];
            document.getElementById("alg2_name").innerText = replyObj.name[1];
            document.getElementById("alg3_name").innerText = replyObj.name[2];
            document.getElementById("alg4_name").innerText = replyObj.name[3];
            document.getElementById("alg5_name").innerText = replyObj.name[4];

            // put the algorithms' F1 scores in their ranked order
            document.getElementById("alg1_f1").innerText = replyObj.f1[0];
            document.getElementById("alg2_f1").innerText = replyObj.f1[1];
            document.getElementById("alg3_f1").innerText = replyObj.f1[2];
            document.getElementById("alg4_f1").innerText = replyObj.f1[3];
            document.getElementById("alg5_f1").innerText = replyObj.f1[4];
        }
        else {
            console.log("Error getting ranked algorithms/F1 scores from the backend server. (Is it running?)");
        }
    }

    // for debug purposes until the server communication is implemented
    var placeholder_name = "qaoweifj";
    var placeholder_f1 = "75.43%";
    document.getElementById("alg1_name").innerText = placeholder_name;
    document.getElementById("alg1_f1").innerText = placeholder_f1;
}
 No newline at end of file