Added more logging
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pünkösd Marcell 2021-12-13 06:50:28 +01:00
parent d455bc07e8
commit a23971a47a

View File

@ -48,6 +48,8 @@ class ModelMemer:
if os.path.isfile(model_file) and self._loaded_model:
return
print("Model file needs to be downloaded. Doing it...", flush=True)
r = requests.get(Config.MODEL_INFO_URL)
r.raise_for_status()
self.model_details = r.json()
@ -154,11 +156,13 @@ def main():
while True:
message = requeue.get(block=True)
print('New sample recieved... start classifying!', flush=True)
task = pickle.loads(message)
audio_file_path = task['audio_file_path']
description = task['description']
try:
result = run_classification(audio_file_path, memer)
print("Result of classification:", result, flush=True)
if result:
# upload to real input service
files = {
@ -173,9 +177,12 @@ def main():
r = requests.post(Config.INPUT_SERVICE_URL, files=files)
r.raise_for_status()
print("Upload response status:", r.status_code, flush=True)
print("Upload response body:", r.content, flush=True)
finally:
os.remove(audio_file_path)
# if scheduler:
# scheduler.stop()