Update app.py
Browse files
app.py
CHANGED
@@ -34,7 +34,9 @@ model.eval()
|
|
34 |
|
35 |
def transcribe(audio):
|
36 |
sample_rate, waveform = audio
|
37 |
-
|
|
|
|
|
38 |
waveform = torchaudio.functional.resample(waveform, sample_rate, 16_000)
|
39 |
|
40 |
transcript = model.predict(waveform)[0]
|
|
|
34 |
|
35 |
def transcribe(audio):
|
36 |
sample_rate, waveform = audio
|
37 |
+
if len(waveform.shape) == 2:
|
38 |
+
waveform = waveform[:, 0]
|
39 |
+
waveform = torch.from_numpy(waveform).float().unsqueeze_(0)
|
40 |
waveform = torchaudio.functional.resample(waveform, sample_rate, 16_000)
|
41 |
|
42 |
transcript = model.predict(waveform)[0]
|