实时语音识别工具WhisperChain

项目简介

打字很无聊,让我们用语音来加速你的工作流程。本项目结合了:

  • 实时语音识别使用 Whisper.cpp
  • 转录清理使用 LangChain
  • 全局热键支持语音控制
  • 自动剪贴板集成于清洗后的转录


需求

  • Python 3.8+
  • OpenAI API 密钥
  •  适用于 MacOS:
    • ffmpeg(音频处理)
    • PortAudio(用于音频捕获)


安装

  1. 安装系统依赖项(MacOS):
# Install ffmpeg and portaudio using Homebrewbrew install ffmpeg portaudio
  1. Install the project:  安装项目:
pip install whisperchain

配置


WhisperChain 将在以下位置查找配置:

  1. 环境变量
  2. 当前目录中的.env 文件
  3. ~/.whisperchain/.env 文件

首次运行时,如果没有找到配置,您将被提示输入您的 OpenAI API 密钥。密钥将被保存在 ~/.whisperchain/.env 以供将来使用。

您也可以通过以下任何一种方式手动设置您的 OpenAI API 密钥:

# Option 1: Environment variableexport OPENAI_API_KEY=your-api-key-here
# Option 2: Create .env file in current directoryecho "OPENAI_API_KEY=your-api-key-here" > .env
# Option 3: Create global configmkdir -p ~/.whisperchainecho "OPENAI_API_KEY=your-api-key-here" > ~/.whisperchain/.env


使用

  1. 1  启动应用程序:
# Run with default settingswhisperchain
# Run with custom configurationwhisperchain --config config.json
# Override specific settingswhisperchain --port 8080 --hotkey "<ctrl>+<alt>+t" --model "large" --debug
  1. 2 使用全局快捷键(默认为 <ctrl>+<alt>+r 。MacOS 上为 <ctrl>+<option>+r ):
    • 按住并保持以开始录音
    • 说出你的文本
    • 释放以停止录制
    • 清洗后的转录将被自动复制到您的剪贴板
      粘贴(Ctrl+V)以粘贴转录内容




项目链接

https://github.com/chrischoy/WhisperChain

扫码加入技术交流群,备注开发语言-城市-昵称

(文:GitHubStore)

发表评论