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 <justin.georgi@gmail.com>

Reviewed-on: Georgi_Lab/ALVINN_f7#99
This commit is contained in:
2024-02-20 08:44:37 -07:00
parent 79d2d1bc83
commit 69ede91f7b

View File

@@ -333,6 +333,7 @@
this.detectorName = 'thorax' this.detectorName = 'thorax'
this.classesList = thoraxClasses this.classesList = thoraxClasses
this.modelLocation = '../models/thorax_tfwm/model.json' this.modelLocation = '../models/thorax_tfwm/model.json'
this.modelLocationCordova = 'https://localhost/models/thorax_tfwm/model.json'
break; break;
case 'abdomen': case 'abdomen':
this.activeRegion = 1 this.activeRegion = 1
@@ -375,8 +376,11 @@
} else { } else {
self.modelLoading = true self.modelLoading = true
self.detectorLabels = self.classesList.map( l => { return {'name': l, 'detect': 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 self.modelLoading = false
}).catch((e) => {
console.log(e.message)
f7.dialog.alert(`ALVINN AI model error: ${e.message}`)
}) })
} }
window.onresize = (e) => { this.selectChip('redraw') } window.onresize = (e) => { this.selectChip('redraw') }
@@ -449,7 +453,10 @@
self.detecting = false self.detecting = false
self.resultData = dets self.resultData = dets
self.uploadDirty = true self.uploadDirty = true
}) }).catch((e) => {
console.log(e.message)
f7.dialog.alert(`ALVINN structure finding error: ${e.message}`)
})
} }
}, },
remoteTimeout () { remoteTimeout () {