https://github.com/namastexlabs/whisperx-api
Whisperx API implementation
https://github.com/namastexlabs/whisperx-api
ai api text-to-speech transcription tts whisper
Last synced: about 1 year ago
JSON representation
Whisperx API implementation
- Host: GitHub
- URL: https://github.com/namastexlabs/whisperx-api
- Owner: namastexlabs
- Created: 2023-08-28T04:19:41.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-03T06:02:32.000Z (about 2 years ago)
- Last Synced: 2025-05-10T16:11:17.686Z (about 1 year ago)
- Topics: ai, api, text-to-speech, transcription, tts, whisper
- Language: Python
- Homepage: https://whisperx.namastex.io/docs
- Size: 16.6 MB
- Stars: 27
- Watchers: 1
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Whisperx API Wrapper
An API Wrapper for [Whisperx Library](https://github.com/m-bain/whisperX)
## Overview
This is a FastAPI application that provides an endpoint for video/audio transcription using the `whisperx` command. The application supports multiple audio and video formats. It performs the transcription, alignment, and diarization of the uploaded media files.
## Features
- User Authentication with JWT
- Support for multiple audio and video formats
- Diarization support
- Customizable language and model settings
## Requirements
- whisperx
- Python 3.8+
- FastAPI
- ffmpeg
- SQLite
- pyjwt
- dotenv
Follow the instructions on how to install Whisperx [in the official repository](https://github.com/m-bain/whisperX#3-install-this-repo)
You can install these dependencies using the `requirements.txt` file:
```bash
pip install -r requirements.txt
```
## Environment Variables
Create a `.env` file in your root directory and add the following variables:
```env
SECRET_KEY=your_secret_key
MASTER_KEY=your_master_key
HUGGING_FACE_TOKEN=your_hugging_face_token
API_PORT=11300
```
## Database Setup
SQLite is used for storing user information. The database is created automatically when the application runs.
## Running the Application
Run the application using:
```bash
python api_whisperx.py
```
Replace `main` with the name of your Python file if it's not `main.py`.
## API Endpoints
### POST `/auth`
Authenticate a user and return a JWT token.
- `username`: The username of the user.
- `password`: The password of the user.
### POST `/create_user`
Create a new user.
- `username`: Desired username.
- `password`: Desired password.
- `master_key`: Master key for authorized user creation.
### POST `/whisperx-transcribe/`
Transcribe an uploaded audio or video file.
- `file`: The audio or video file to transcribe.
- `lang`: Language for transcription (default is "pt").
- `model`: Model to use for transcription (default is "large-v2").
- `min_speakers`: Minimum number of speakers for diarization (default is 1).
- `max_speakers`: Maximum number of speakers for diarization (default is 2).
## Logging
The application has built-in logging that informs about the steps being performed and any errors that occur.