added lapatoloas

This commit is contained in:
Pünkösd Marcell 2021-12-02 21:43:58 +01:00
parent 6c259c1451
commit 99aa33b1df

View File

@ -5,6 +5,8 @@ import requests
import json
import uwsgi
import pickle
from threading import Thread
from queue import Queue
from urllib.parse import urljoin
from config import Config
@ -111,11 +113,20 @@ def run_classification(audio_file_path: str, memer: ModelMemer):
return bool((class_id == memer.target_id) and (probability[class_id] > 0.5))
def main():
memer = ModelMemer()
def lapatolas(q: Queue):
while True:
message = uwsgi.mule_get_msg()
q.put(message)
def main():
memer = ModelMemer()
requeue = Queue()
Thread(target=lapatolas, args=(requeue,), daemon=True).start()
while True:
message = requeue.get(block=True)
task = pickle.loads(message)
audio_file_path = task['audio_file_path']
description = task['description']