Update subgen.py

This commit is contained in:
McCloudS
2024-03-19 11:49:52 -06:00
committed by GitHub
parent 0ce705f0ca
commit 1af00d962f

View File

@@ -23,8 +23,6 @@ import av
import ffmpeg
import whisper
import re
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
def convert_to_bool(in_bool):
if isinstance(in_bool, bool):
@@ -53,6 +51,7 @@ use_path_mapping = convert_to_bool(os.getenv('USE_PATH_MAPPING', False))
path_mapping_from = os.getenv('PATH_MAPPING_FROM', r'/tv')
path_mapping_to = os.getenv('PATH_MAPPING_TO', r'/Volumes/TV')
model_location = os.getenv('MODEL_PATH', './models')
monitor = convert_to_bool(os.getenv('MONITOR', False))
transcribe_folders = os.getenv('TRANSCRIBE_FOLDERS', '')
transcribe_or_translate = os.getenv('TRANSCRIBE_OR_TRANSLATE', 'transcribe')
force_detected_language_to = os.getenv('FORCE_DETECTED_LANGUAGE_TO', '')
@@ -65,6 +64,10 @@ append = convert_to_bool(os.getenv('APPEND', False))
if transcribe_device == "gpu":
transcribe_device = "cuda"
if monitor:
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
app = FastAPI()
model = None
files_to_transcribe = []