Updated model svc api
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pünkösd Marcell 2020-10-02 03:49:37 +02:00
parent 2238fe08f9
commit f6e0b7b25e

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python3
import requests
from urllib.parse import urljoin
from pyAudioAnalysis.audioTrainTest import load_model, load_model_knn, classifier_wrapper
from utils import config
from .abcpreprocessor import AbcPreProcessor
@ -40,14 +41,16 @@ class SoundPreProcessor(AbcPreProcessor):
else:
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()
self._model_details = r.json()
logging.debug("Downloading model...")
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()
with open(temp_model_handle, 'wb') as f: # bruhtastic
@ -55,7 +58,7 @@ class SoundPreProcessor(AbcPreProcessor):
logging.debug("Downloading MEANS...")
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()
with open(self._temp_means_name, 'wb') as f: