jhj0517 commited on
Commit
5f193dc
·
1 Parent(s): f12a40c

Refactor return type

Browse files
modules/whisper/base_transcription_pipeline.py CHANGED
@@ -179,7 +179,7 @@ class BaseTranscriptionPipeline(ABC):
179
  add_timestamp: bool = True,
180
  progress=gr.Progress(),
181
  *pipeline_params,
182
- ) -> list:
183
  """
184
  Write subtitle file from Files
185
 
@@ -250,7 +250,7 @@ class BaseTranscriptionPipeline(ABC):
250
  result_str = f"Done in {self.format_time(total_time)}! Subtitle is in the outputs folder.\n\n{total_result}"
251
  result_file_path = [info['path'] for info in files_info.values()]
252
 
253
- return [result_str, result_file_path]
254
 
255
  except Exception as e:
256
  print(f"Error transcribing file: {e}")
@@ -264,7 +264,7 @@ class BaseTranscriptionPipeline(ABC):
264
  add_timestamp: bool = True,
265
  progress=gr.Progress(),
266
  *pipeline_params,
267
- ) -> list:
268
  """
269
  Write subtitle file from microphone
270
 
@@ -314,7 +314,7 @@ class BaseTranscriptionPipeline(ABC):
314
  )
315
 
316
  result_str = f"Done in {self.format_time(time_for_task)}! Subtitle file is in the outputs folder.\n\n{subtitle}"
317
- return [result_str, file_path]
318
  except Exception as e:
319
  print(f"Error transcribing mic: {e}")
320
  raise
@@ -327,7 +327,7 @@ class BaseTranscriptionPipeline(ABC):
327
  add_timestamp: bool = True,
328
  progress=gr.Progress(),
329
  *pipeline_params,
330
- ) -> list:
331
  """
332
  Write subtitle file from Youtube
333
 
@@ -385,7 +385,7 @@ class BaseTranscriptionPipeline(ABC):
385
  if os.path.exists(audio):
386
  os.remove(audio)
387
 
388
- return [result_str, file_path]
389
 
390
  except Exception as e:
391
  print(f"Error transcribing youtube: {e}")
 
179
  add_timestamp: bool = True,
180
  progress=gr.Progress(),
181
  *pipeline_params,
182
+ ) -> Tuple[str, str]:
183
  """
184
  Write subtitle file from Files
185
 
 
250
  result_str = f"Done in {self.format_time(total_time)}! Subtitle is in the outputs folder.\n\n{total_result}"
251
  result_file_path = [info['path'] for info in files_info.values()]
252
 
253
+ return result_str, result_file_path
254
 
255
  except Exception as e:
256
  print(f"Error transcribing file: {e}")
 
264
  add_timestamp: bool = True,
265
  progress=gr.Progress(),
266
  *pipeline_params,
267
+ ) -> Tuple[str, str]:
268
  """
269
  Write subtitle file from microphone
270
 
 
314
  )
315
 
316
  result_str = f"Done in {self.format_time(time_for_task)}! Subtitle file is in the outputs folder.\n\n{subtitle}"
317
+ return result_str, file_path
318
  except Exception as e:
319
  print(f"Error transcribing mic: {e}")
320
  raise
 
327
  add_timestamp: bool = True,
328
  progress=gr.Progress(),
329
  *pipeline_params,
330
+ ) -> Tuple[str, str]:
331
  """
332
  Write subtitle file from Youtube
333
 
 
385
  if os.path.exists(audio):
386
  os.remove(audio)
387
 
388
+ return result_str, file_path
389
 
390
  except Exception as e:
391
  print(f"Error transcribing youtube: {e}")