This commit is contained in:
@ -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)
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user