1.2 KiB
1.2 KiB
Whisper Transcription Service
This is a standalone HTTP service for transcribing audio files using the OpenAI Whisper model.
Prerequisites
Make sure you have Python 3.9+.
The service uses imageio-ffmpeg to provide ffmpeg binary automatically. You do not need to install system ffmpeg manually.
Setup & Run
- Create a virtual environment and install dependencies:
cd whisper
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
- Start the server:
python main.py
Or run with uvicorn directly:
uvicorn main:app --host 0.0.0.0 --port 8001 --reload
The service will run on http://localhost:8001.
API Endpoint
-
GET /health- Returns:
{"status": "ok"}
- Returns:
-
POST /transcribe- Body:
multipart/form-datawith afilefield containing the audio blob. - Returns:
{"text": "transcribed text..."}
- Body:
Frontend Integration
In DataClaw frontend:
- Click username at bottom-left to open user menu.
- Click
语音输入配置. - Fill in service URL, e.g.
http://localhost:8001. - Click
测试连接first, then click保存.
After configuration, click the mic button in chat input area to start voice input.