""" # Copyright (C) 2024 - 2030. All Rights Reserved # Email:dafenqicool@163.com # Authors:enzo 2025 / 2 / 12 语音转换文字 """ import whisper # 加载 Whisper 模型 model = whisper.load_model("small") # "base", "small", "medium", "large" 也可以选择 def transcribe_with_whisper(audio_file): result = model.transcribe(audio_file, language="zh") return result["text"] # 示例 # m4a_file = "D:\\wendang\\长庆油田陇东生产指挥中心 7.m4a" m4a_file = "D:\\wendang\\20250113_150033.m4a" # m4a_file = "D:\\wendang\\新录音.m4a" text = transcribe_with_whisper(m4a_file) print(text)