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