2838f64922fc1ea21b9152154f832b395b81983f
Whisper Speech-to-Text API Service
Overview
This project is a lightweight, OpenAI-compatible API server for transcribing audio to text using the Whisper model. It's designed to run locally, making it easy to set up and use for speech-to-text tasks.
Features
- OpenAI API Compatibility: Fully compatible with OpenAI's
/v1/audio/transcriptionsand/v1/modelsendpoints. - Local File Support: Transcribe audio files stored locally on your machine.
- Multiple Input Methods: Supports:
- Local file paths
- Files accessible via URL
- Base64-encoded audio
- Multipart form uploads
- Easy Setup: Designed to run as a local service with minimal configuration.
- Hardware Optimization: Utilizes GPU (CUDA, MPS) or CPU for efficient processing.
- Health Check: Includes a
/healthendpoint for service monitoring.
Recommended Model
For Russian language transcription, we recommend using the whisper-large-v3-russian model from Hugging Face. This model is fine-tuned specifically for Russian speech recognition and delivers high accuracy.
Perfect for local development or offline use cases where OpenAI's API isn't accessible.
Quick Start
-
Edit the Configuration File (
config.json):- Set the path to your Whisper model (
model_path). - Configure other parameters like language (
language), chunk size (chunk_length_s), batch size (batch_size), and audio normalization settings.
{ "service_port": 5042, "model_path": "/path/to/your/whisper-model", "language": "english", "chunk_length_s": 30, "batch_size": 16, "max_new_tokens": 256, "return_timestamps": false, "norm_level": "-0.5", "compand_params": "0.3,1 -90,-90,-70,-70,-60,-20,0,0 -5 0 0.2" } - Set the path to your Whisper model (
-
Run the Server:
- Simply execute the
server.shscript:
./server.sh- If you need to update the environment, use:
./server.sh --update - Simply execute the
-
Use the API:
- Once the server is running, you can send transcription requests.
- Example request (curl):
curl -X POST -F file=@audio.wav http://localhost:5042/v1/audio/transcriptions
Enjoy seamless audio-to-text transcription with your local Whisper API server!
Languages
Python
52.1%
HTML
45.7%
Shell
1.8%
Dockerfile
0.4%