Spaces:
Edmond98
/
Running on A100

vineelpratap commited on
Commit
e628248
1 Parent(s): 8140dae

Update lid.py

Browse files
Files changed (1) hide show
  1. lid.py +4 -1
lid.py CHANGED
@@ -25,7 +25,10 @@ def identify(audio_data):
25
  # microphone
26
  sr, audio_samples = audio_data
27
  audio_samples = (audio_samples / 32768.0).astype(np.float32)
28
- assert sr == LID_SAMPLING_RATE, "Invalid sampling rate"
 
 
 
29
  else:
30
  # file upload
31
  isinstance(audio_data, str)
 
25
  # microphone
26
  sr, audio_samples = audio_data
27
  audio_samples = (audio_samples / 32768.0).astype(np.float32)
28
+ if sr != ASR_SAMPLING_RATE:
29
+ audio_samples = librosa.resample(
30
+ audio_samples, orig_sr=sr, target_sr=ASR_SAMPLING_RATE
31
+ )
32
  else:
33
  # file upload
34
  isinstance(audio_data, str)