Update modules/whisper/whisper_base.py
Browse files- modules/whisper/whisper_base.py +15 -17
modules/whisper/whisper_base.py
CHANGED
@@ -408,24 +408,22 @@ class WhisperBase(ABC):
|
|
408 |
|
409 |
if file_count_total > 1:
|
410 |
if file_count > 1:
|
411 |
-
total_result += "
|
412 |
|
413 |
# Add filename & info as first line
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
|
|
425 |
total_time += info["time_for_task"]
|
426 |
-
|
427 |
-
total_result = total_result.replace("\t"," ")
|
428 |
-
total_result = total_result.replace("\n","<BR>")
|
429 |
|
430 |
time_end = datetime.now()
|
431 |
total_info = f"Processed {file_count} {'file' if file_count == 1 else 'files'} in {self.format_time((time_end-time_start).total_seconds())}"
|
@@ -631,9 +629,9 @@ class WhisperBase(ABC):
|
|
631 |
@staticmethod
|
632 |
def transform_text_to_list(inputdata: str) -> list:
|
633 |
outputdata = []
|
634 |
-
temp_inputdata = inputdata.split("
|
635 |
for temp_line in temp_inputdata:
|
636 |
-
temp_line_items = temp_line.split("
|
637 |
col_time,col_speaker,col_text = "","",""
|
638 |
|
639 |
if len(temp_line_items)==1:
|
|
|
408 |
|
409 |
if file_count_total > 1:
|
410 |
if file_count > 1:
|
411 |
+
total_result += "\n"
|
412 |
|
413 |
# Add filename & info as first line
|
414 |
+
html_multi_tab = (" ")*3
|
415 |
+
html_single_tab = " "
|
416 |
+
html_newline = "<BR>"
|
417 |
+
title_line = f'{html_multi_tab}Media file:{html_single_tab}{info["input_source_file"]}'
|
418 |
+
title_line += f'{html_newline}{html_multi_tab}Language:{html_single_tab}{info["lang"]} (probability {info["lang_prob"]}%)'
|
419 |
+
if params.is_translate: title_line += f'{html_newline}{html_multi_tab}Translation:{html_single_tab}{info["transcription"]} (Handled by OpenAI Whisper)'
|
420 |
+
if translate_output: title_line += f'{html_newline}{html_multi_tab}Translation:{html_single_tab}{info["translation"]} (Handled by Facebook NLLB)'
|
421 |
+
|
422 |
+
if info["subtitle"] == "":
|
423 |
+
info["subtitle"] = "(No speech detected)"
|
424 |
+
|
425 |
+
total_result += title_line+"\n"+f'{info["subtitle"]}'
|
426 |
total_time += info["time_for_task"]
|
|
|
|
|
|
|
427 |
|
428 |
time_end = datetime.now()
|
429 |
total_info = f"Processed {file_count} {'file' if file_count == 1 else 'files'} in {self.format_time((time_end-time_start).total_seconds())}"
|
|
|
629 |
@staticmethod
|
630 |
def transform_text_to_list(inputdata: str) -> list:
|
631 |
outputdata = []
|
632 |
+
temp_inputdata = inputdata.split("\n")
|
633 |
for temp_line in temp_inputdata:
|
634 |
+
temp_line_items = temp_line.split("\t")
|
635 |
col_time,col_speaker,col_text = "","",""
|
636 |
|
637 |
if len(temp_line_items)==1:
|