This commit is contained in:
parent
2238fe08f9
commit
f6e0b7b25e
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import requests
|
import requests
|
||||||
|
from urllib.parse import urljoin
|
||||||
from pyAudioAnalysis.audioTrainTest import load_model, load_model_knn, classifier_wrapper
|
from pyAudioAnalysis.audioTrainTest import load_model, load_model_knn, classifier_wrapper
|
||||||
from utils import config
|
from utils import config
|
||||||
from .abcpreprocessor import AbcPreProcessor
|
from .abcpreprocessor import AbcPreProcessor
|
||||||
@ -40,14 +41,16 @@ class SoundPreProcessor(AbcPreProcessor):
|
|||||||
else:
|
else:
|
||||||
model_id_to_get = '$default'
|
model_id_to_get = '$default'
|
||||||
|
|
||||||
r = requests.get(f"{config.API_URL}/model/svm/{model_id_to_get}/details")
|
model_root_url = urljoin(config.API_URL, f"/model/svm/{model_id_to_get}")
|
||||||
|
|
||||||
|
r = requests.get(model_root_url)
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
|
|
||||||
self._model_details = r.json()
|
self._model_details = r.json()
|
||||||
|
|
||||||
logging.debug("Downloading model...")
|
logging.debug("Downloading model...")
|
||||||
BirbnetesIoTPlatformStatusDriver.enqueue_pattern('green', [1])
|
BirbnetesIoTPlatformStatusDriver.enqueue_pattern('green', [1])
|
||||||
r = requests.get(f"{config.API_URL}/model/svm/{self._model_details['id']}")
|
r = requests.get(urljoin(model_root_url, self._model_details['files']['model']))
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
|
|
||||||
with open(temp_model_handle, 'wb') as f: # bruhtastic
|
with open(temp_model_handle, 'wb') as f: # bruhtastic
|
||||||
@ -55,7 +58,7 @@ class SoundPreProcessor(AbcPreProcessor):
|
|||||||
|
|
||||||
logging.debug("Downloading MEANS...")
|
logging.debug("Downloading MEANS...")
|
||||||
BirbnetesIoTPlatformStatusDriver.enqueue_pattern('green', [1])
|
BirbnetesIoTPlatformStatusDriver.enqueue_pattern('green', [1])
|
||||||
r = requests.get(f"{config.API_URL}/model/svm/{self._model_details['id']}?means")
|
r = requests.get(urljoin(model_root_url, self._model_details['files']['means']))
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
|
|
||||||
with open(self._temp_means_name, 'wb') as f:
|
with open(self._temp_means_name, 'wb') as f:
|
||||||
|
Loading…
Reference in New Issue
Block a user