Update modules/whisper/whisper_base.py
Browse files
modules/whisper/whisper_base.py
CHANGED
@@ -428,11 +428,32 @@ class WhisperBase(ABC):
|
|
428 |
result_file_path = [info['path'] for info in files_to_download.values()]
|
429 |
#total_info += f"Total processing time:\t{self.format_time((time_end-time_start).total_seconds())}"
|
430 |
|
431 |
-
|
432 |
-
new_headers = [
|
433 |
-
|
434 |
-
|
435 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
436 |
return [(gr.update(value=updated_data)),result_file_path,total_info]
|
437 |
#return [result_str,result_file_path,total_info]
|
438 |
|
|
|
428 |
result_file_path = [info['path'] for info in files_to_download.values()]
|
429 |
#total_info += f"Total processing time:\t{self.format_time((time_end-time_start).total_seconds())}"
|
430 |
|
431 |
+
# Format Dataframe data
|
432 |
+
new_headers = []
|
433 |
+
new_column_widths = []
|
434 |
+
new_datatype = []
|
435 |
+
|
436 |
+
if add_timestamp_preview==True and diarize_speakers==True:
|
437 |
+
new_headers = ["Time","Speaker","Text"]
|
438 |
+
new_column_widths = ["10%","15%","70%"]
|
439 |
+
new_datatype = ["str","str","markdown"]
|
440 |
+
elif add_timestamp_preview==True and diarize_speakers==False:
|
441 |
+
new_headers = ["Time","Text"]
|
442 |
+
new_column_widths = ["10%","85%"]
|
443 |
+
new_datatype = ["str","markdown"]
|
444 |
+
elif add_timestamp_preview==False and diarize_speakers==True:
|
445 |
+
new_headers = ["Speaker","Text"]
|
446 |
+
new_column_widths = ["15%","80%"]
|
447 |
+
new_datatype = ["str","markdown"]
|
448 |
+
elif add_timestamp_preview==False and diarize_speakers==False:
|
449 |
+
new_headers = ["Text"]
|
450 |
+
new_column_widths = ["95%"]
|
451 |
+
new_datatype = ["markdown"]
|
452 |
+
|
453 |
+
new_data_rows = self.transform_text_to_list(total_result)
|
454 |
+
#updated_data = {"headers": new_headers, "data": new_data_rows}
|
455 |
+
updated_data = {"headers": new_headers, "data": new_data_rows, "column_widths": new_column_widths, "datatype": new_datatype}
|
456 |
+
|
457 |
return [(gr.update(value=updated_data)),result_file_path,total_info]
|
458 |
#return [result_str,result_file_path,total_info]
|
459 |
|