File size: 2,750 Bytes
5a96bc1
 
 
 
 
 
 
44624d5
 
5a96bc1
 
44624d5
72bb965
9a8424a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44624d5
9a8424a
 
 
 
 
 
5a96bc1
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!doctype html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width" />
		<title>My static Space</title>
		<link rel="stylesheet" href="style.css" />
        <!-- Get the ort from the cdn -->
        <script src="https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/ort.min.js"> </script>
	</head>
	<body>
        <script>

        function checkInference(){
                const radioAlarm = document.getElementById("radioAlarm").value;
                const basePortAlarm = document.getElementById("basePortAlarm").value;
                console.log("Radio Alarm is: " + radioAlarm + ", and Base Port Alarm is : " + basePortAlarm);
                runInference(radioAlarm, basePortAlarm);
        }

        async function runInference(radio_alarm, base_port_alarm) {
                //const session = await ort.InferenceSession.create('./alarm_threshold/alarm_threshold.ort', {logSeverityLevel: 3}, {executionProviders: ['wasm']});
                const session = await ort.InferenceSession.create('./lambda_suppression.ort', {executionProviders: ['wasm']});   
                console.log(session.inputNames);
                console.log(session.outputNames);
                ort.env.logLevel = 'verbose';
        
                //inputs: ["RadioLink_Alarm", "BasePort_Down"]
                //outputs: ["Final_Alarm"]
                const inputs = {
                         "RadioLink_Alarm": new ort.Tensor("int64", BigInt64Array.from([BigInt(radio_alarm)]), [1]),
                        "BasePort_Down": new ort.Tensor("int64", BigInt64Array.from([BigInt(base_port_alarm)]), [1])
                };
                
                output = await session.run(inputs);
                result = output.Final_Alarm.data[0];
                console.log("Final Alarm is : " + result);
                modelResults = document.getElementById("modelResults");
                modelResults.value = "";
                if(result == "1"){//if there is no base port alarm, alarm is not suppressed
                        modelResults.value = "Alarm is not suppressed, as base port alarm is absent";
                } else { modelResults.value = "Alarm is suppressed in presence of base port alarm";}
                
                }       
</script>
		<div >
			<h1>Welcome to rr19tech Alarm Suppression Model!</h1>
            <span>Radio Alarm</span><input type="text" id="radioAlarm"/><br/>
            <span>Base Port Alarm</span><input type="text" id="basePortAlarm"/><br/>
            <input type="button" value="test" onclick="checkInference()"/><br/>
            <span>Model Evaluation Results</span><br/>
            <textarea id="modelResults" rows=10 cols=50></textarea>
		</div>
	</body>
</html>