Update modules/whisper/whisper_base.py
Browse files
modules/whisper/whisper_base.py
CHANGED
|
@@ -424,7 +424,7 @@ class WhisperBase(ABC):
|
|
| 424 |
result_file_path = [info['path'] for info in files_to_download.values()]
|
| 425 |
#total_info += f"Total processing time:\t{self.format_time((time_end-time_start).total_seconds())}"
|
| 426 |
|
| 427 |
-
return [gr.update(value={"data": self.transform_text_to_list(total_result)}),result_file_path,total_info]
|
| 428 |
#return [result_str,result_file_path,total_info]
|
| 429 |
|
| 430 |
except Exception as e:
|
|
@@ -618,17 +618,18 @@ class WhisperBase(ABC):
|
|
| 618 |
gc.collect()
|
| 619 |
|
| 620 |
@staticmethod
|
| 621 |
-
def transform_text_to_list(inputdata: str) -> list:
|
| 622 |
outputdata = []
|
| 623 |
temp_inputdata = inputdata.split("#NEWLINE#")
|
| 624 |
for temp_line in temp_inputdata:
|
| 625 |
temp_line_list = []
|
| 626 |
temp_line_items = temp_line.split("#TAB#")
|
| 627 |
|
| 628 |
-
# Add
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
|
|
|
| 632 |
|
| 633 |
for temp_line_item in temp_line_items:
|
| 634 |
temp_line_list.append(temp_line_item)
|
|
|
|
| 424 |
result_file_path = [info['path'] for info in files_to_download.values()]
|
| 425 |
#total_info += f"Total processing time:\t{self.format_time((time_end-time_start).total_seconds())}"
|
| 426 |
|
| 427 |
+
return [gr.update(value={"data": self.transform_text_to_list(total_result,add_timestamp_preview,diarize_speakers)}),result_file_path,total_info]
|
| 428 |
#return [result_str,result_file_path,total_info]
|
| 429 |
|
| 430 |
except Exception as e:
|
|
|
|
| 618 |
gc.collect()
|
| 619 |
|
| 620 |
@staticmethod
|
| 621 |
+
def transform_text_to_list(inputdata: str,timestamps: bool, diarize: bool) -> list:
|
| 622 |
outputdata = []
|
| 623 |
temp_inputdata = inputdata.split("#NEWLINE#")
|
| 624 |
for temp_line in temp_inputdata:
|
| 625 |
temp_line_list = []
|
| 626 |
temp_line_items = temp_line.split("#TAB#")
|
| 627 |
|
| 628 |
+
# Add columns to match Dataframe
|
| 629 |
+
if timestamps==True and diarize==False:
|
| 630 |
+
temp_line_items.insert(1,"")
|
| 631 |
+
if timestamps==False and diarize==True:
|
| 632 |
+
temp_line_items.insert(0,"")
|
| 633 |
|
| 634 |
for temp_line_item in temp_line_items:
|
| 635 |
temp_line_list.append(temp_line_item)
|