Introduction to OpenAI Whisper Webapp
The OpenAI Whisper project is an intriguing implementation of an automatic speech recognition (ASR) system using the Next.js framework. This project is a sample web application showcasing how OpenAI’s Whisper, a sophisticated AI-driven transcription technology, can be employed to automatically recognize and convert spoken language into text.
Key Features
-
Automated Audio Recording and Transcription: The web application records audio data automatically, uploads it to a server for transcription or translation, and then sends the results back to the frontend. Users can also review the recorded audio to verify the accuracy of the transcriptions.
-
Real-time-like Processing: Although Whisper is not specifically designed for real-time streaming, this project attempts to provide an 'almost real-time' transcription experience. The application's effectiveness largely depends on the server's ability to quickly transcribe or translate incoming audio data.
Technical Details
-
Next.js Integration: The application uses Next.js, allowing it to operate efficiently without the need for separate backend and frontend apps.
-
Command Execution: On the server side, the project utilizes the
exec
command to invoke Whisper. Due to current limitations, Whisper cannot be directly imported as a Node.js module; instead, it is typically used through a Python server. -
Model and Language Settings: The application leverages the 'tiny' Whisper model, prioritizing speed for transcription tasks. Users can adjust various settings, such as language preferences and noise threshold, to tailor the app’s performance based on specific needs.
User Interface
The webapp's interface has undergone significant changes over time. Now, audio recording only starts when sound is detected, avoiding unnecessary data capture due to background noise. Users can adjust the noise detection threshold and other settings, like minDecibels
to remove background noise and maxPause
to control recording duration.
The page also displays the time period of the recorded audio, enabling users to compare audio playback with the transcribed text. The application is built using class components, providing easier access to state variables during development.
How to Set Up
To use the OpenAI Whisper webapp, follow these steps:
-
Install Whisper and Dependencies: Use pip to install Whisper and its dependencies along with ffmpeg for processing audio files.
$ pip install git+https://github.com/openai/whisper.git $ brew install ffmpeg # for macOS
-
Clone the Repository: Download the project code from the GitHub repository, install the necessary Node.js packages, and start the development server.
$ git clone https://github.com/supershaneski/openai-whisper.git myproject $ cd myproject $ npm install $ npm run dev
-
Access the Application: Open a web browser and navigate to
http://localhost:3006/
to use the application.
Using HTTPS
For users who prefer using HTTPS, which is essential for security when capturing audio from separate devices, the application can be configured accordingly. Users need to prepare the correct certificate and key files, modify the server.js
, and start the server using:
$ node server.js
This enables access via https://localhost:3006/
.
Conclusion
The OpenAI Whisper project is an exciting endeavor that showcases how cutting-edge ASR and AI technologies can be integrated with modern web frameworks to create intuitive and effective speech-to-text applications. The project continues to evolve, promising more features and improvements in the future.