Skip to content

Commit

Permalink
Add cast column to speech recognition example
Browse files Browse the repository at this point in the history
  • Loading branch information
arxyzan committed Aug 15, 2023
1 parent 8588e22 commit 6229ced
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/speech_recognition_example.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from hezar import Model
from datasets import load_dataset
from datasets import load_dataset, Audio

ds = load_dataset("mozilla-foundation/common_voice_11_0", "fa", split="test")
df = ds.cast_column("audio", Audio(sampling_rate=16000))
sample = ds[1001]
whisper = Model.load("hezarai/whisper-small-fa")
transcript = whisper.predict(sample["path"]) # or pass `sample["audio"]["array"]` (with the right sample rate)
Expand Down

0 comments on commit 6229ced

Please sign in to comment.