Skip to content

Commit 64e824c

Browse files
authored
Add quickstart example (#1)
1 parent ccc9e77 commit 64e824c

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

README.md

+45
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,51 @@ This blueprint guides you to ...
3434

3535
## Quick-start
3636

37+
Create a virtual environment and install the dependencies:
38+
39+
``` sh
40+
python3 -m venv .venv
41+
source .venv/bin/activate
42+
python3 -m pip install 'whisper-bidec @ https://github.com/OHF-Voice/whisper-bidec/archive/refs/tags/v0.0.1.tar.gz'
43+
```
44+
45+
Download an example WAV file:
46+
47+
``` sh
48+
wget "https://github.com/OHF-Voice/whisper-bidec/raw/refs/heads/main/tests/wav/what's%20the%20temperature%20of%20the%20EcoBee.wav"
49+
```
50+
51+
Test transcribing the WAV file without any bias:
52+
53+
``` sh
54+
python3 -m whisper_bidec "what's the temperature of the EcoBee.wav"
55+
```
56+
57+
This outputs CSV with the format `wav file|text without bias|text with bias` like:
58+
59+
``` csv
60+
what's the temperature of the EcoBee.wav|What's the temperature of the incubi?|What's the temperature of the incubi?
61+
```
62+
63+
Without bias, the WAV file is incorrectly transcribed as "What's the temperature of the **incubi**?"
64+
65+
Let's add a few example sentences that will bias Whisper towards the "EcoBee" device:
66+
67+
``` sh
68+
cat > example_sentences.txt <<EOF
69+
What's the temperature of the EcoBee?
70+
What is the temperature of the EcoBee?
71+
EOF
72+
```
73+
74+
Now we can see the corrected transcript:
75+
76+
``` sh
77+
python3 -m whisper_bidec --text example_sentences.txt "what's the temperature of the EcoBee.wav"
78+
what's the temperature of the EcoBee.wav|What's the temperature of the incubi?|What's the temperature of the EcoBee?
79+
```
80+
81+
The bias can be adjusted with `--bias-towards-lm <BIAS>` which defaults to 0.5. Increasing this value will bias Whisper more towards the example sentences.
3782
3883
## How it Works
3984

0 commit comments

Comments
 (0)