Spaces:
Running
Running
Updated the code logic for alarm suppression.
Browse files- index.html +38 -12
index.html
CHANGED
|
@@ -10,20 +10,46 @@
|
|
| 10 |
</head>
|
| 11 |
<body>
|
| 12 |
<script>
|
| 13 |
-
async function runInference() {
|
| 14 |
-
const session = await ort.InferenceSession.create('./alarm_threshold.ort', {logSeverityLevel: 3});
|
| 15 |
-
console.log(session.inputNames);
|
| 16 |
-
console.log(session.outputNames);
|
| 17 |
-
txtarea = document.getElementById('showData');
|
| 18 |
-
txtarea.value="Checking the model with inputs: " + session.inputNames + ", and output : " + session.outputNames;
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
<div >
|
| 24 |
-
<h1>Welcome to rr19tech Alarm
|
| 25 |
-
|
| 26 |
-
<input type="
|
|
|
|
|
|
|
|
|
|
| 27 |
</div>
|
| 28 |
</body>
|
| 29 |
</html>
|
|
|
|
| 10 |
</head>
|
| 11 |
<body>
|
| 12 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
function checkInference(){
|
| 15 |
+
const radioAlarm = document.getElementById("radioAlarm").value;
|
| 16 |
+
const basePortAlarm = document.getElementById("basePortAlarm").value;
|
| 17 |
+
console.log("Radio Alarm is: " + radioAlarm + ", and Base Port Alarm is : " + basePortAlarm);
|
| 18 |
+
runInference(radioAlarm, basePortAlarm);
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
async function runInference(radio_alarm, base_port_alarm) {
|
| 22 |
+
//const session = await ort.InferenceSession.create('./alarm_threshold/alarm_threshold.ort', {logSeverityLevel: 3}, {executionProviders: ['wasm']});
|
| 23 |
+
const session = await ort.InferenceSession.create('./lambda_suppression.ort', {executionProviders: ['wasm']});
|
| 24 |
+
console.log(session.inputNames);
|
| 25 |
+
console.log(session.outputNames);
|
| 26 |
+
ort.env.logLevel = 'verbose';
|
| 27 |
+
|
| 28 |
+
//inputs: ["RadioLink_Alarm", "BasePort_Down"]
|
| 29 |
+
//outputs: ["Final_Alarm"]
|
| 30 |
+
const inputs = {
|
| 31 |
+
"RadioLink_Alarm": new ort.Tensor("int64", BigInt64Array.from([BigInt(radio_alarm)]), [1]),
|
| 32 |
+
"BasePort_Down": new ort.Tensor("int64", BigInt64Array.from([BigInt(base_port_alarm)]), [1])
|
| 33 |
+
};
|
| 34 |
+
|
| 35 |
+
output = await session.run(inputs);
|
| 36 |
+
result = output.Final_Alarm.data[0];
|
| 37 |
+
console.log("Final Alarm is : " + result);
|
| 38 |
+
modelResults = document.getElementById("modelResults");
|
| 39 |
+
modelResults.value = "";
|
| 40 |
+
if(result == "1"){//if there is no base port alarm, alarm is not suppressed
|
| 41 |
+
modelResults.value = "Alarm is not suppressed, as base port alarm is absent";
|
| 42 |
+
} else { modelResults.value = "Alarm is suppressed in presence of base port alarm";}
|
| 43 |
+
|
| 44 |
+
}
|
| 45 |
+
</script>
|
| 46 |
<div >
|
| 47 |
+
<h1>Welcome to rr19tech Alarm Suppression Model!</h1>
|
| 48 |
+
<span>Radio Alarm</span><input type="text" id="radioAlarm"/><br/>
|
| 49 |
+
<span>Base Port Alarm</span><input type="text" id="basePortAlarm"/><br/>
|
| 50 |
+
<input type="button" value="test" onclick="checkInference()"/><br/>
|
| 51 |
+
<span>Model Evaluation Results</span><br/>
|
| 52 |
+
<textarea id="modelResults" rows=10 cols=50></textarea>
|
| 53 |
</div>
|
| 54 |
</body>
|
| 55 |
</html>
|