LAP-DEV commited on
Commit
0f29c4e
·
verified ·
1 Parent(s): ac5dff2

Update modules/whisper/whisper_base.py

Browse files
Files changed (1) hide show
  1. modules/whisper/whisper_base.py +11 -8
modules/whisper/whisper_base.py CHANGED
@@ -286,12 +286,15 @@ class WhisperBase(ABC):
286
  Output file path to return to gr.Files()
287
  """
288
 
289
- file_count_total = 0
290
- if input_multi != "Single":
291
- files = files_multi
292
- file_count_total = len(files)
293
-
294
  try:
 
 
 
 
 
 
 
 
295
  if input_folder_path:
296
  files = get_media_files(input_folder_path)
297
  if isinstance(files, str):
@@ -362,9 +365,10 @@ class WhisperBase(ABC):
362
  else:
363
  translation_note = "Already in " + target_lang
364
 
365
- ## Get preview
366
  file_name, file_ext = os.path.splitext(os.path.basename(file))
367
- ## With or without timestamps
 
368
  if add_timestamp_preview:
369
  subtitle = get_txt(transcribed_segments)
370
  else:
@@ -373,7 +377,6 @@ class WhisperBase(ABC):
373
 
374
  ## Add output file as txt, srt and/or csv
375
  for output_format in file_format:
376
- file_name, file_ext = os.path.splitext(os.path.basename(file))
377
  subtitle, file_path = self.generate_and_write_file(
378
  file_name=file_name,
379
  transcribed_segments=transcribed_segments,
 
286
  Output file path to return to gr.Files()
287
  """
288
 
 
 
 
 
 
289
  try:
290
+ for file in files:
291
+ print("File to process: "+str(file))
292
+
293
+ file_count_total = 0
294
+ if input_multi != "Single":
295
+ files = files_multi
296
+ file_count_total = len(files)
297
+
298
  if input_folder_path:
299
  files = get_media_files(input_folder_path)
300
  if isinstance(files, str):
 
365
  else:
366
  translation_note = "Already in " + target_lang
367
 
368
+ ## Get input filename & extension
369
  file_name, file_ext = os.path.splitext(os.path.basename(file))
370
+
371
+ ## Get output as preview with or without timestamps
372
  if add_timestamp_preview:
373
  subtitle = get_txt(transcribed_segments)
374
  else:
 
377
 
378
  ## Add output file as txt, srt and/or csv
379
  for output_format in file_format:
 
380
  subtitle, file_path = self.generate_and_write_file(
381
  file_name=file_name,
382
  transcribed_segments=transcribed_segments,