-
Notifications
You must be signed in to change notification settings - Fork 81
tutorial whisper #3760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SC-Samir
wants to merge
6
commits into
master
Choose a base branch
from
whisper-ai
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+118
−0
Open
tutorial whisper #3760
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e04885b
tutorial whisper
SC-Samir 631eaac
Update the tutorial with Etienne advice
SC-Samir 9411c94
Solve issue
SC-Samir b95d878
fix francois comment
SC-Samir 41ffaf6
fix format
SC-Samir 07cd170
Update src/_tutorials/whisper/index.md
SC-Samir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| --- | ||
| title: Building Speech to Text with OpenAI Whisper | ||
| logo: openai | ||
| category: ai | ||
| permalink: /tutorials/whisper | ||
| modified_at: 2026-07-24 | ||
| kind: demo | ||
| last_reviewed_at: 2026-07-24 | ||
| --- | ||
|
|
||
| **[Whisper]** is a general-purpose Automatic Speech Recognition (ASR) model for converting speech into text. It was trained on a large, multilingual audio corpus, which makes it robust to different accents, background noise, and real-world conditions. As an open source model, it is well suited for developers who want to integrate speech to text without depending entirely on a proprietary SaaS or API. | ||
|
|
||
| **[faster-whisper]** is an optimized reimplementation of OpenAI's Whisper model built on the [CTranslate2] inference engine. It delivers the same transcription quality as Whisper while significantly improving inference speed and reducing memory usage, making it well suited for production deployments and resource-constrained environments such as Scalingo. | ||
|
|
||
| In this tutorial, we use faster-whisper to create a small speech-to-text app featuring a Python backend as well as a minimal HTTP/Javascript frontend. | ||
|
|
||
| ## Planning your Deployment | ||
|
|
||
| - Whisper is available in several sizes (`tiny`, `small`, `medium`, ...). We recommend to start with the `small` size, and switch for a larger model if accuracy becomes an issue. | ||
| - The size of the container mainly depends on the size of the model you wish to use. The table below gives some rough recommendations. Please scale up or down depending on your use case and measured performances: | ||
|
|
||
| | Model Size | Container Size | | ||
| | ---------: | :------------- | | ||
| | tiny | L | | ||
| | base | L | | ||
| | small | XL or 2XL | | ||
| | medium | 3XL | | ||
| | large | 3XL | | ||
| | turbo | 3XL | | ||
|
|
||
| ## Deploying the Application | ||
|
|
||
| ### Using the Command Line | ||
|
|
||
| 1. Clone the repository: | ||
|
|
||
| ```bash | ||
| git clone https://github.com/Scalingo/scalingo-labs | ||
| cd scalingo-labs/whisper-speech-to-text | ||
| ``` | ||
|
|
||
| 2. Create the application on Scalingo: | ||
|
|
||
| ```bash | ||
| scalingo create my-whisper | ||
| ``` | ||
|
|
||
| The Scalingo command line automatically detects the Git repository and | ||
| adds a Git remote pointing to Scalingo: | ||
|
|
||
| ```bash | ||
| git remote -v | ||
|
|
||
| origin https://github.com/Scalingo/scalingo-labs (fetch) | ||
| origin https://github.com/Scalingo/scalingo-labs (push) | ||
| scalingo git@ssh.osc-fr1.scalingo.com:my-whisper.git (fetch) | ||
| scalingo git@ssh.osc-fr1.scalingo.com:my-whisper.git (push) | ||
| ``` | ||
|
|
||
| 3. Set the model size to use: | ||
|
|
||
| ```bash | ||
| scalingo --app my-whisper env-set MODEL_SIZE=small | ||
| ``` | ||
|
|
||
| 4. Deploy to Scalingo: | ||
|
|
||
| ```bash | ||
| git push scalingo main | ||
| ``` | ||
|
|
||
| Scalingo detects the Python environment, installs the dependencies declared by the project, and starts the application using the [Procfile]. The speech to text demo is now deployed. | ||
|
|
||
| ## Testing the Deployment | ||
|
|
||
| Since the model is downloaded the first time the container starts, query the `/health` endpoint to check the model status: | ||
|
|
||
| ```bash | ||
| curl https://my-whisper.osc-fr1.scalingo.io/health | ||
| ``` | ||
|
|
||
| The output should look like this: | ||
|
|
||
| ```bash | ||
| {"ok":true,"model":"tiny","status":"ready","ready":true} | ||
| ``` | ||
|
|
||
| Check that the status field is set to ready before opening the application in a browser and testing the recording from the HTML interface. | ||
|
|
||
| The transcription endpoint can also be tested directly with `curl`. For example, if the audio file is in the current directory of your computer: | ||
|
|
||
| ```bash | ||
| curl --request POST https://my-whisper.osc-fr1.scalingo.io/transcribe \ | ||
| --form "file=@sample.webm" | ||
| ``` | ||
|
|
||
| The backend writes the uploaded file to `/tmp`, transcribes it, then returns a JSON response containing the transcript and model metadata. | ||
|
|
||
| In this demo the transcription runs synchronously. This demo can be adapted to an asynchronous workflow, for example by offloading the transcription to a background job. | ||
|
|
||
| ## Customizing | ||
|
|
||
| ### Environment | ||
|
|
||
| `MODEL_SIZE` | ||
| : Size of the model to use.\\ | ||
| Check [Whisper][whisper] documentation for available values.\\ | ||
| **Don't forget to adjust the size of your container(s) accordingly.**\\ | ||
| Defaults to `small`. | ||
|
|
||
|
SC-Samir marked this conversation as resolved.
|
||
| *[ASR]: Automatic Speech Recognition | ||
| [whisper]: https://github.com/openai/whisper | ||
| [faster-whisper]: https://github.com/SYSTRAN/faster-whisper | ||
| [fastapi]: https://fastapi.tiangolo.com | ||
| [CTranslate2]: https://github.com/OpenNMT/CTranslate2 | ||
|
|
||
| [procfile]: {% post_url platform/app/2000-01-01-procfile %} | ||
|
SC-Samir marked this conversation as resolved.
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.