jhj0517 commited on
Commit
c8ae5e5
1 Parent(s): 09744fa

remove meaningless process

Browse files
Files changed (1) hide show
  1. modules/faster_whisper_inference.py +1 -16
modules/faster_whisper_inference.py CHANGED
@@ -273,11 +273,10 @@ class FasterWhisperInference(BaseInterface):
273
  task="translate" if istranslate and self.current_model_size in self.translatable_models else "transcribe"
274
  )
275
  progress(0, desc="Loading audio..")
276
- total_frames = self.get_total_frames(audio=audio, progress=progress)
277
 
278
  segments_result = []
279
  for segment in segments:
280
- progress(segment.seek / total_frames, desc="Transcribing..")
281
  segments_result.append({
282
  "start": segment.start,
283
  "end": segment.end,
@@ -303,20 +302,6 @@ class FasterWhisperInference(BaseInterface):
303
  compute_type="float16"
304
  )
305
 
306
- def get_total_frames(self,
307
- audio: Union[str, BinaryIO],
308
- progress: gr.Progress
309
- ) -> float:
310
- """
311
- This method is only for tracking the progress.
312
- Returns total frames to track progress.
313
- """
314
- progress(0, desc="Loading audio..")
315
- decoded_audio = faster_whisper.decode_audio(audio)
316
- features = self.model.feature_extractor(decoded_audio)
317
- content_frames = features.shape[-1] - self.model.feature_extractor.nb_max_frames
318
- return content_frames
319
-
320
  @staticmethod
321
  def generate_and_write_subtitle(file_name: str,
322
  transcribed_segments: list,
 
273
  task="translate" if istranslate and self.current_model_size in self.translatable_models else "transcribe"
274
  )
275
  progress(0, desc="Loading audio..")
 
276
 
277
  segments_result = []
278
  for segment in segments:
279
+ progress(segment.start / info.duration, desc="Transcribing..")
280
  segments_result.append({
281
  "start": segment.start,
282
  "end": segment.end,
 
302
  compute_type="float16"
303
  )
304
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
  @staticmethod
306
  def generate_and_write_subtitle(file_name: str,
307
  transcribed_segments: list,