Python 智能语音识别的功能

python 复制代码
import speech_recognition as sr

def voice_recognition():
    # 创建语音识别对象
    r = sr.Recognizer()
    # 从麦克风中获取音频
    with sr.Microphone() as source:
        print("Please speak...")
        audio = r.listen(source)
    try:
        # 使用 Google Speech Recognition API 进行识别
        text = r.recognize_google(audio, language='zh-CN')
        print("You said: ", text)
    except sr.UnknownValueError:
        print("Google Speech Recognition could not understand audio")
    except sr.RequestError as e:
        print("Could not request results from Google Speech Recognition service; {0}".format(e))
相关推荐
寻道模式13 小时前
【时间之外】AI不懂Mac吗?
人工智能·macos
挂科边缘13 小时前
手把手教你使用 Faster-Whisper 实时语音输入转文本,本地部署教程
人工智能·语言模型·whisper·faster-whisper·实时语音输入转文本
逗逗班学Python13 小时前
基于 Faster-Whisper 的本地语音转字幕与会议纪要系统:从音频转写到 SRT 字幕与 Markdown 纪要完整项目实战
python·语音识别·faster-whisper·字幕生成·会议纪要
SUNNY_SHUN13 小时前
把 Whisper、Moonshine、SenseVoice 统统装进手机:sherpa-onnx 离线语音部署框架,GitHub 10.9K Star
人工智能·智能手机·whisper·github
The moon forgets13 小时前
ABot-M0:基于动作流形学习的机器人操作VLA基础模型深度解析
人工智能·pytorch·python·学习·具身智能·vla·点云分割
云烟成雨TD13 小时前
Spring AI 1.x 系列【42】MCP 服务端 Spring Boot 启动器
java·人工智能·spring
有什么事13 小时前
云端虚拟手机:未来移动计算新革命
人工智能·智能手机·云计算
城事漫游Molly13 小时前
AI赋能质性研究(六):跨案例比较分析,5个高质量 Prompt让AI帮你找模式
大数据·人工智能·prompt·ai for science·定性研究
云烟成雨TD13 小时前
Spring AI 1.x 系列【38】模型上下文协议(MCP)
java·人工智能·spring
Alson_Code14 小时前
Spring AI-1.1.0
java·人工智能·后端·spring·ai编程