konieshadow commited on
Commit
6b9b193
·
1 Parent(s): 5d8d9c8

优化mlx_whisper模块的导入方式,改为在方法内部导入transcribe函数,以提高代码可读性和模块化。

Browse files
src/podcast_transcribe/asr/asr_distil_whisper_mlx.py CHANGED
@@ -6,7 +6,6 @@ import os
6
  from pydub import AudioSegment
7
  from typing import Dict, List, Union
8
  import logging
9
- import mlx_whisper
10
 
11
  # 导入基类
12
  from .asr_base import BaseTranscriber, TranscriptionResult
@@ -77,7 +76,8 @@ class MLXDistilWhisperTranscriber(BaseTranscriber):
77
  返回:
78
  模型的转录结果
79
  """
80
- return mlx_whisper.transcribe(audio_data, path_or_hf_repo=self.model_name)
 
81
 
82
  def _get_text_from_result(self, result):
83
  """
 
6
  from pydub import AudioSegment
7
  from typing import Dict, List, Union
8
  import logging
 
9
 
10
  # 导入基类
11
  from .asr_base import BaseTranscriber, TranscriptionResult
 
76
  返回:
77
  模型的转录结果
78
  """
79
+ from mlx_whisper import transcribe
80
+ return transcribe(audio_data, path_or_hf_repo=self.model_name)
81
 
82
  def _get_text_from_result(self, result):
83
  """