From 69ede91f7ba550b31c6f3cf301504b140819a4ab Mon Sep 17 00:00:00 2001 From: Justin Georgi Date: Tue, 20 Feb 2024 08:44:37 -0700 Subject: [PATCH] Fix fetch issue in android cordova (#99) Tensorflow fetch failed on android with basic configuration. More specific protocol and location for model.json required. Signed-off-by: Justin Georgi Reviewed-on: https://gitea.azgeorgis.net/Georgi_Lab/ALVINN_f7/pulls/99 --- src/pages/detect.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pages/detect.vue b/src/pages/detect.vue index 5627e5e..95b4820 100644 --- a/src/pages/detect.vue +++ b/src/pages/detect.vue @@ -333,6 +333,7 @@ this.detectorName = 'thorax' this.classesList = thoraxClasses this.modelLocation = '../models/thorax_tfwm/model.json' + this.modelLocationCordova = 'https://localhost/models/thorax_tfwm/model.json' break; case 'abdomen': this.activeRegion = 1 @@ -375,8 +376,11 @@ } else { self.modelLoading = true self.detectorLabels = self.classesList.map( l => { return {'name': l, 'detect': true} } ) - self.loadModel(self.modelLocation).then(() => { + self.loadModel(self.isCordova ? self.modelLocationCordova : self.modelLocation).then(() => { self.modelLoading = false + }).catch((e) => { + console.log(e.message) + f7.dialog.alert(`ALVINN AI model error: ${e.message}`) }) } window.onresize = (e) => { this.selectChip('redraw') } @@ -449,7 +453,10 @@ self.detecting = false self.resultData = dets self.uploadDirty = true - }) + }).catch((e) => { + console.log(e.message) + f7.dialog.alert(`ALVINN structure finding error: ${e.message}`) + }) } }, remoteTimeout () {