Fix int casting on detect_language_length
This commit is contained in:
@@ -466,7 +466,7 @@ def detect_language(
|
||||
#encode: bool = Query(default=True, description="Encode audio first through ffmpeg") # This is always false from Bazarr
|
||||
):
|
||||
detected_lang_code = "" # Initialize with an empty string
|
||||
if detect_language_length != 30:
|
||||
if int(detect_language_length) != 30:
|
||||
logging.info(f"Detect language is set to detect on the first {detect_language_length} seconds of the audio.")
|
||||
try:
|
||||
start_model()
|
||||
@@ -476,7 +476,7 @@ def detect_language(
|
||||
task_queue.put(task_id)
|
||||
|
||||
audio_data = np.frombuffer(audio_file.file.read(), np.int16).flatten().astype(np.float32) / 32768.0
|
||||
detected_lang_code = model.transcribe_stable(whisper.pad_or_trim(audio_data, detect_language_length * 16000), input_sr=16000).language
|
||||
detected_lang_code = model.transcribe_stable(whisper.pad_or_trim(audio_data, int(detect_language_length) * 16000), input_sr=16000).language
|
||||
|
||||
except Exception as e:
|
||||
logging.info(f"Error processing or transcribing Bazarr {audio_file.filename}: {e}")
|
||||
|
||||
Reference in New Issue
Block a user