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:
|
||||
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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user