Vineel Pratap commited on
Commit
1be831a
1 Parent(s): 6f27821

fix sampling rate

Browse files
Files changed (3) hide show
  1. .gitignore +1 -0
  2. app.py +2 -2
  3. zeroshot.py +3 -1
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ __pycache__
app.py CHANGED
@@ -33,7 +33,7 @@ with gr.Blocks(css="style.css") as demo:
33
  wscore = gr.Slider(
34
  minimum=-10.0,
35
  maximum=10.0,
36
- value=WORD_SCORE_DEFAULT_IF_NOLM,
37
  step=0.1,
38
  interactive=False,
39
  label="Word Insertion Score",
@@ -46,7 +46,7 @@ with gr.Blocks(css="style.css") as demo:
46
  lmscore = gr.Slider(
47
  minimum=-10.0,
48
  maximum=10.0,
49
- value=0,
50
  step=0.1,
51
  interactive=False,
52
  label="Language Model Score",
 
33
  wscore = gr.Slider(
34
  minimum=-10.0,
35
  maximum=10.0,
36
+ value=WORD_SCORE_DEFAULT_IF_LM,
37
  step=0.1,
38
  interactive=False,
39
  label="Word Insertion Score",
 
46
  lmscore = gr.Slider(
47
  minimum=-10.0,
48
  maximum=10.0,
49
+ value=LM_SCORE_DEFAULT,
50
  step=0.1,
51
  interactive=False,
52
  label="Language Model Score",
zeroshot.py CHANGED
@@ -125,7 +125,9 @@ def process(
125
  # microphone
126
  sr, audio_samples = audio_data
127
  audio_samples = (audio_samples / 32768.0).astype(float)
128
- assert sr == ASR_SAMPLING_RATE, "Invalid sampling rate"
 
 
129
  else:
130
  # file upload
131
  assert isinstance(audio_data, str)
 
125
  # microphone
126
  sr, audio_samples = audio_data
127
  audio_samples = (audio_samples / 32768.0).astype(float)
128
+
129
+ if sr != ASR_SAMPLING_RATE:
130
+ audio_samples = librosa.resample(audio_samples, sr, ASR_SAMPLING_RATE)
131
  else:
132
  # file upload
133
  assert isinstance(audio_data, str)