From fede1fcf45098637d7d9d63afae739f475abdfc9 Mon Sep 17 00:00:00 2001 From: vladislav Date: Tue, 15 Jul 2025 00:32:45 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=B4=D1=80=D0=BE=D0=B1=D0=BD=D1=8B=D0=B9=20Readme?= =?UTF-8?q?.md=20=D1=81=20=D0=B8=D0=BD=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 102 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d343b76..95fea9e 100644 --- a/README.md +++ b/README.md @@ -1 +1,102 @@ -Not whisper anymore :) +# Whisper Transcription API + +This project provides a RESTful API for audio transcription using a Whisper model. The API is built with FastAPI and runs in a Docker container. + +## Prerequisites + +Before you begin, ensure you have the following installed: + +* [Docker](https://docs.docker.com/get-docker/) +* [Docker Compose](https://docs.docker.com/compose/install/) + +## Project Structure + +``` +. +├── app.py # Main application file with FastAPI endpoint +├── docker-compose.yml # Docker Compose configuration +├── Dockerfile # Dockerfile for building the application image +├── model/ # Directory for Whisper model files +└── requirements.txt # Python dependencies +``` + +## Setup + +1. **Clone the repository:** + + ```bash + git clone https://github.com/SlavaVlad/faster-whisper-api + cd faster-whisper-api + ``` +3. **Add API keys:** + + Create a `keys.txt` file in the root of the project and add your API keys, one per line. + +## Building and Running the Project + +You can build and run the project using Docker Compose. + +1. **Build the Docker image:** + + ```bash + docker-compose build + ``` + +2. **Run the container:** + + ```bash + docker-compose up + ``` + + The application will be available at `http://0.0.0.0:9854`. + +## API Endpoint + +### POST /transcribe + +This endpoint accepts an audio file and returns the transcription. + +* **URL:** `/transcribe` +* **Method:** `POST` +* **Headers:** + * `X-API-Key`: Your API key. +* **Form Data:** + * `file`: The audio file to be transcribed. + +**Example using `curl`:** + +```bash +curl -X POST "http://localhost:9854/transcribe" \ + -H "X-API-Key: YOUR_API_KEY" \ + -F "file=@/path/to/your/audio.wav" +``` + +**Successful Response (200 OK):** + +```json +{ + "transcription": [ + { + "start_time": 0.0, + "end_time": 2.5, + "transcription": "Hello world." + } + ], + "text": "Hello world. ", + "metrics": { + "processing_time": 5.2, + "rtf": 0.5, + "word_rate": 2.0 + } +} +``` + +**Error Response (401 Unauthorized):** + +If the API key is missing or invalid. + +```json +{ + "detail": "Invalid API Key" +} +```