Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ SR = 16000
|
|
16 |
|
17 |
|
18 |
def resample(speech_array, sampling_rate):
|
19 |
-
speech = torch.from_numpy(
|
20 |
print(speech, speech.shape, sampling_rate)
|
21 |
resampler = torchaudio.transforms.Resample(sampling_rate)
|
22 |
speech = resampler(speech).squeeze().numpy()
|
@@ -47,6 +47,7 @@ print(device)
|
|
47 |
|
48 |
def recognize(audio):
|
49 |
sr, audio_array = audio
|
|
|
50 |
print(sr, audio_array)
|
51 |
return predict(audio_array, sr)
|
52 |
|
|
|
16 |
|
17 |
|
18 |
def resample(speech_array, sampling_rate):
|
19 |
+
speech = torch.from_numpy(speech_array)
|
20 |
print(speech, speech.shape, sampling_rate)
|
21 |
resampler = torchaudio.transforms.Resample(sampling_rate)
|
22 |
speech = resampler(speech).squeeze().numpy()
|
|
|
47 |
|
48 |
def recognize(audio):
|
49 |
sr, audio_array = audio
|
50 |
+
audio_array = audio_array.astype(np.float32)
|
51 |
print(sr, audio_array)
|
52 |
return predict(audio_array, sr)
|
53 |
|