-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
31 lines (27 loc) · 1.01 KB
/
app.js
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
const zerorpc = require("zerorpc")
let client = new zerorpc.Client()
client.connect("tcp://127.0.0.1:4242")
client.invoke("echo", "server ready", (error, res) => {
if(error || res !== 'server ready') {
console.error(error)
} else {
console.log("server is ready")
}
})
const { ipcRenderer } = require( "electron" );
document.addEventListener( "DOMContentLoaded", () => {
const version = process.version;
const e = document.getElementById( "info" );
e.textContent = `I'm running Node.js version: ${ version }`;
const btn = document.getElementById( "clickme" );
btn.addEventListener( "click", e => {
client.invoke("detect_yolo", "/home/deep307/SHARE/TRAFFICHAIN/POC_TrafficViolation/pyDL/data/APA-0102-CE8J4yKmTEQ.mp4",(error, msg) => {
if(error) {
console.error(error)
} else {
console.log( "Detecting traffic violation." );
ipcRenderer.send( "show-dialog", { message: msg } );
}
} );
} );
} );