Ar4ikov commited on
Commit
55f31c4
1 Parent(s): 3032b2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -16,7 +16,7 @@ SR = 16000
16
 
17
 
18
  def resample(speech_array, sampling_rate):
19
- speech = torch.from_numpy(np.array([speech_array])).float()
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