Spaces:
Running
Running
| <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> | |