Remove model root in favor of relative urls
All checks were successful
Build Dev PWA / Build-PWA (push) Successful in 37s

Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
2024-08-20 17:34:46 -07:00
parent 56a6d85f75
commit daf17bcdff

View File

@@ -140,8 +140,9 @@
import detectionMixin from './detection-mixin' import detectionMixin from './detection-mixin'
import cameraMixin from './camera-mixin' import cameraMixin from './camera-mixin'
import detectionWorker from '../assets/detect-worker.js?worker&inline' import detectionWorker from '@/assets/detect-worker.js?worker&inline'
// import thoraxModel from '/models/thorax/model.json?url' // import thoraxModel from '/models/thorax/model.json?url'
// console.log(thoraxModel)
// import thoraxModelMini from '/models/thorax-mini/model.json?url' // import thoraxModelMini from '/models/thorax-mini/model.json?url'
export default { export default {
@@ -192,7 +193,6 @@
created () { created () {
let loadOtherSettings = localStorage.getItem('otherSettings') let loadOtherSettings = localStorage.getItem('otherSettings')
if (loadOtherSettings) this.otherSettings = JSON.parse(loadOtherSettings) if (loadOtherSettings) this.otherSettings = JSON.parse(loadOtherSettings)
let modelRoot = new URL(import.meta.url).origin
this.detectorName = this.f7route.params.region this.detectorName = this.f7route.params.region
switch (this.detectorName) { switch (this.detectorName) {
case 'thorax': case 'thorax':
@@ -208,9 +208,9 @@
this.activeRegion = 3 this.activeRegion = 3
break; break;
} }
this.modelLocation = new URL(`/models/${this.detectorName}${this.otherSettings.mini ? '-mini' : ''}/model.json`,modelRoot).href this.modelLocation = `/models/${this.detectorName}${this.otherSettings.mini ? '-mini' : ''}/model.json`
this.miniLocation = new URL(`./models/${this.detectorName}-mini/model.json`,modelRoot).href this.miniLocation = `/models/${this.detectorName}-mini/model.json`
fetch(`${modelRoot}/models/${this.detectorName}/classes.json`) fetch(`/models/${this.detectorName}/classes.json`)
.then((mod) => { return mod.json() }) .then((mod) => { return mod.json() })
.then((classes) => { .then((classes) => {
this.classesList = classes this.classesList = classes