Finally fixed
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
Pünkösd Marcell 2021-11-23 21:33:06 +01:00
parent dd2a3cfff5
commit 6c259c1451
5 changed files with 28 additions and 17 deletions

View File

@ -1,4 +1,4 @@
FROM python:3.9
FROM registry.kmlabz.com/birbnetes/ai-base-image
ADD svm_prefilter_service requirements.txt uwsgi.ini /svm_prefilter_service/
WORKDIR /svm_prefilter_service/

View File

@ -17,22 +17,24 @@ cython
six
deprecation
cycler~=0.10.0
cycler==0.10.0
deprecation==2.0.7
eyeD3==0.9.5
filetype==1.0.6
hmmlearn==0.2.3
joblib~=1.0.1
kiwisolver~=1.2.0
matplotlib~=3.3.3
numpy~=1.20.3
joblib==0.14.1
kiwisolver==1.2.0
matplotlib==3.2.1
numpy==1.18.2
pydub==0.23.1
pyparsing==2.4.6
python-dateutil==2.8.1
scikit-learn~=0.24.0
scipy~=1.6.2
simplejson~=3.17.2
scikit-learn==0.21.3
scipy==1.4.1
simplejson==3.17.0
six==1.14.0
plotly
pyAudioAnalysis~=0.3.0
tqdm~=4.61.1
tqdm==4.61.1

View File

@ -22,6 +22,13 @@ if Config.SENTRY_DSN:
)
def json_datetime_dumper(o):
if hasattr(o, "isoformat"):
return o.isoformat()
else:
return str(o)
class ModelMemer:
def __init__(self):
@ -41,13 +48,13 @@ class ModelMemer:
r.raise_for_status()
self.model_details = r.json()
r = requests.get(urljoin(Config.MODEL_INFO_URL,self.model_details['files']['model']))
r = requests.get(urljoin(Config.MODEL_INFO_URL, self.model_details['files']['model']))
r.raise_for_status()
with open(model_file, 'wb') as f:
f.write(r.content)
r = requests.get(urljoin(Config.MODEL_INFO_URL,self.model_details['files']['means']))
r = requests.get(urljoin(Config.MODEL_INFO_URL, self.model_details['files']['means']))
r.raise_for_status()
with open(means_file, 'wb') as f:
@ -123,7 +130,7 @@ def main():
'audio/wave',
{'Content-length': os.path.getsize(audio_file_path)}
),
"description": (None, json.dumps(description), "application/json")
"description": (None, json.dumps(description, default=json_datetime_dumper), "application/json")
}
r = requests.post(Config.INPUT_SERVICE_URL, files=files)

View File

@ -36,8 +36,9 @@ class FilterView(FlaskView):
current_app.logger.exception(e)
return abort(417, 'Input JSON schema invalid')
soundfile_handle, soundfile_path = tempfile.mkstemp()
soundfile.save(open(soundfile_handle, "wb+"))
soundfile_handle, soundfile_path = tempfile.mkstemp(suffix=".wav")
with open(soundfile_handle, "wb+") as f:
soundfile.save(f)
task = {
"audio_file_path": soundfile_path,

View File

@ -9,4 +9,5 @@ die-on-term = true
manage-script-name = true
mount=/=app:app
mule=mule.py
mule=mule.py
uid=33