Make everything work in processes and adding config to customize instance

This commit is contained in:
Jaikinator
2023-12-07 16:22:52 +01:00
parent 32b27442e6
commit 9eb9f5af8d
6 changed files with 241 additions and 96 deletions
+13 -7
View File
@@ -3,16 +3,22 @@ Stores global variables for the app.
"""
# Global variable to store the model
from threading import Event
import multiprocessing
import os
import time
import yaml
REQUEST_QUEUE = multiprocessing.Queue() # audio file path as string
RESPONSE_QUEUE = multiprocessing.Queue() # transcription as string
LAST_ACTIVE_TIME = multiprocessing.Value('d', time.time()) # time of last activity
LOADED_EVENT = multiprocessing.Event() # model loaded event
RUNNING_EVENT = multiprocessing.Event() # model running event
MODEL = None
MODEL_THREAD_PARAMS = None
MODEL_THREAD = None
MODEL_PARAMS = None # model parameters
MODEL_PROCESS = None # model process to handle globally
# Global variable to track user activity
LAST_USED = time.time()
TIMEOUT = 30 #seconds
TRANSCRIBE_ACTIVE = Event()
TIMEOUT = None #seconds
DEFAULT_APP_CONIFG_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "config.yml")