from deepspeech import Model import scipy.io.wavfile as wav import numpy as np # 指定模型和评分器文件路径 model_path = 'model/deepspeech-0.9.3-models-zh-CN.pbmm' scorer_path = 'model/deepspeech-0.9.3-models-zh-CN.scorer' # 初始化DeepSpeech模型 ds = Model(model_path) ds.enableExternalScorer(scorer_path) # 加载音频文件 audio_path = 'audio/input.wav' fs, audio = wav.read(audio_path) # 进行语音转文字 text = ds.stt(audio) print('Transcribed text:', text)