LAP-DEV commited on
Commit
67c0ab1
·
verified ·
1 Parent(s): 0d1183b

Update modules/whisper/whisper_base.py

Browse files
Files changed (1) hide show
  1. modules/whisper/whisper_base.py +8 -4
modules/whisper/whisper_base.py CHANGED
@@ -410,10 +410,8 @@ class WhisperBase(ABC):
410
  file_count += 1
411
 
412
  # Add filename & info as first line
413
- title_line = ""
414
  tabbed_space = "\t"*3
415
- if add_timestamp_preview: title_line += "#TAB#"
416
- if diarize_speakers: title_line += "#TAB#"
417
  title_line += f'{tabbed_space}Media file:\t{info["input_source_file"]}'
418
  title_line += f'\n{tabbed_space}Language:\t{info["lang"]} (probability {info["lang_prob"]}%)'
419
  if params.is_translate: title_line += f'\n{tabbed_space}Translation:\t{info["transcription"]} (Handled by OpenAI Whisper)'
@@ -428,7 +426,7 @@ 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
- return [(gr.update(value={"data": self.transform_text_to_list(total_result)})),result_file_path,total_info]
432
  #return [result_str,result_file_path,total_info]
433
 
434
  except Exception as e:
@@ -628,6 +626,12 @@ class WhisperBase(ABC):
628
  for temp_line in temp_inputdata:
629
  temp_line_list = []
630
  temp_line_items = temp_line.split("#TAB#")
 
 
 
 
 
 
631
  for temp_line_item in temp_line_items:
632
  temp_line_list.append(temp_line_item)
633
  outputdata.append(temp_line_list)
 
410
  file_count += 1
411
 
412
  # Add filename & info as first line
413
+ title_line = "#TAB#"*2
414
  tabbed_space = "\t"*3
 
 
415
  title_line += f'{tabbed_space}Media file:\t{info["input_source_file"]}'
416
  title_line += f'\n{tabbed_space}Language:\t{info["lang"]} (probability {info["lang_prob"]}%)'
417
  if params.is_translate: title_line += f'\n{tabbed_space}Translation:\t{info["transcription"]} (Handled by OpenAI Whisper)'
 
426
  result_file_path = [info['path'] for info in files_to_download.values()]
427
  #total_info += f"Total processing time:\t{self.format_time((time_end-time_start).total_seconds())}"
428
 
429
+ return [gr.update(value={"data": self.transform_text_to_list(total_result)}),result_file_path,total_info]
430
  #return [result_str,result_file_path,total_info]
431
 
432
  except Exception as e:
 
626
  for temp_line in temp_inputdata:
627
  temp_line_list = []
628
  temp_line_items = temp_line.split("#TAB#")
629
+
630
+ # Add tabs to match Dataframe columns
631
+ count_items = len(temp_line_items)
632
+ while len(temp_line_items)<3:
633
+ temp_line_items.insert(0,"")
634
+
635
  for temp_line_item in temp_line_items:
636
  temp_line_list.append(temp_line_item)
637
  outputdata.append(temp_line_list)