diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 25feeea..bde511a 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,10 +1,13 @@ - + + + - + + - + @@ -119,11 +122,11 @@ - + - + + +
Prediction =
diff --git a/DataGatherer/src/index.prod.html b/DataGatherer/src/index.prod.html index 3e0228a..3065b19 100644 --- a/DataGatherer/src/index.prod.html +++ b/DataGatherer/src/index.prod.html @@ -6,6 +6,12 @@ predictor_ws_url: 'localhost:8002/predict' } + + +
Prediction =
diff --git a/DataGatherer/src/main.ts b/DataGatherer/src/main.ts index d0e9741..70d2bf2 100644 --- a/DataGatherer/src/main.ts +++ b/DataGatherer/src/main.ts @@ -14,7 +14,7 @@ function main() { ]); - //startPrediction(gatherer); + startPrediction(humanGatherer); // startGathering([humanGatherer, botGatherer]); startGathering([humanGatherer]) } @@ -30,11 +30,15 @@ function getAgentName() { } function startPrediction(gatherer: Gatherer) { - const sender: Sender = new Sender(() => gatherer.getData(), UPS_CONFIGS.gatherer_ws_url,10000); + const sender: Sender = new Sender(() => gatherer.getData(), UPS_CONFIGS.predictor_ws_url,2000); sender.start('http') .subscribe( val => { - console.log(val); + if (val) { + const max = Math.max(...val); + const maxIndex = val.indexOf(max.toString()); + document.getElementById("prediction_value").innerText = val + '\n Stato probabile: ' + maxIndex; + } } ); } @@ -48,7 +52,6 @@ function startGathering(gatherers: Array) { sender.start('ws') .subscribe( val => { - console.log(val); } ); } diff --git a/Predictor/PredictorWebService/src/predictor-web-service/PredictorWebService.ts b/Predictor/PredictorWebService/src/predictor-web-service/PredictorWebService.ts index 170611d..18a8e9f 100644 --- a/Predictor/PredictorWebService/src/predictor-web-service/PredictorWebService.ts +++ b/Predictor/PredictorWebService/src/predictor-web-service/PredictorWebService.ts @@ -68,6 +68,8 @@ export class PredictorWebService { this.app.use(bodyParser.urlencoded({ extended: false })); this.app.post('/predict', function (req, res) { + + //TODO contatta servizio python function generateFakeResponse() { return Array.from({length: 20}, () => Math.random().toPrecision(2)); } diff --git a/docker-compose.yml b/docker-compose.yml index 6c913ef..54155e4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -39,6 +39,7 @@ services: :ro" ports: - "8001:8001" + - "8002:8002" ups_database: image: ups_database