Skip to content

Simple HTTP server that transcribes audio files via faster-whisper.

Notifications You must be signed in to change notification settings

tomgroenwoldt/whatsapp-audio-transcriber

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WhatsApp Audio Transcription with Twilio and Whisper Model

This project is a FastAPI-based web service that transcribes a users WhatsApp audio files using the Whisper model and sends the transcriptions via Twilio back to the user.

2024-09-14.13-55-44.mp4

Features

  • Accepts audio files sent via mobile WhatsApp clients through Twilio webhook.
  • Transcribes audio using Faster Whisper.
  • Sends transcriptions back to the sender's phone number via Twilio.

Setup Twilio Sandbox

Follow the guide in your favorite programming language to setup the WhatsApp sandbox. The main steps are:

  • Create a WhatsApp sandbox.
  • Join the sandbox with a phone.
  • Set the webhook URL.

Setup Application

1. Clone the Repository

git clone https://github.com/your-username/your-repository.git
cd your-repository

2. Install Requirements

python -m venv .venv
.venv/bin/pip install -r requirements.txt

3. Add Your Twilio Credentials

cp .env.example .env

Open .env with your favorite editor and add your Twilio credentials:

TWILIO_ACCOUNT_SID = "your_account_sid_here"
TWILIO_AUTH_TOKEN = "your_auth_token_here"

4. Run the Project

.venv/bin/python server.py

If you want this to work with Twilio you have to expose this service to some public IP. Otherwise, Twilio is unable to reach this service.

4.1 Use Container Image

This repository provides a container image. Pull it with:

docker pull ghcr.io/tomgroenwoldt/whatsapp-audio-transcriber:main

You can run the container by passing your credentials via environment variables:

docker run -p 8000:8000 -e TWILIO_ACCOUNT_SID="your_account_sid_here" -e TWILIO_AUTH_TOKEN="your_auth_token_here" ghcr.io/tomgroenwoldt/whatsapp-audio-transcriber:main

Alternatively, you can setup a compose.yml file that could look something like this:

version: "3.3"

services:
  transcriber:
    image: ghcr.io/tomgroenwoldt/whatsapp-audio-transcriber:main
    ports:
      - 8000:8000
    environment:
      - TWILIO_ACCOUNT_SID=your_account_sid_here # Without quotes!
      - TWILIO_AUTH_TOKEN=your_auth_token_here # Without quotes!

About

Simple HTTP server that transcribes audio files via faster-whisper.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages