Update README.md
Browse files
README.md
CHANGED
@@ -177,7 +177,8 @@ text_inputs = processor(text = "Hello, my dog is cute", src_lang="eng", return_t
|
|
177 |
audio_array_from_text = model.generate(**text_inputs, tgt_lang="rus")[0].cpu().numpy().squeeze()
|
178 |
|
179 |
# from audio
|
180 |
-
audio =
|
|
|
181 |
audio_inputs = processor(audios=audio, return_tensors="pt")
|
182 |
audio_array_from_audio = model.generate(**audio_inputs, tgt_lang="rus")[0].cpu().numpy().squeeze()
|
183 |
```
|
|
|
177 |
audio_array_from_text = model.generate(**text_inputs, tgt_lang="rus")[0].cpu().numpy().squeeze()
|
178 |
|
179 |
# from audio
|
180 |
+
audio, orig_freq = torchaudio.load("https://www2.cs.uic.edu/~i101/SoundFiles/preamble10.wav")
|
181 |
+
audio = torchaudio.functional.resample(audio, orig_freq=orig_freq, new_freq=16_000) # must be a 16 kHz waveform array
|
182 |
audio_inputs = processor(audios=audio, return_tensors="pt")
|
183 |
audio_array_from_audio = model.generate(**audio_inputs, tgt_lang="rus")[0].cpu().numpy().squeeze()
|
184 |
```
|