aditii09 commited on
Commit
ec2699a
1 Parent(s): 47b4091

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -10,7 +10,10 @@ processor = Wav2Vec2Processor.from_pretrained("aditii09/facebook_english_asr")
10
  model = Wav2Vec2ForCTC.from_pretrained("aditii09/facebook_english_asr")
11
 
12
  def speech2text(audio):
13
- sr, data = audio
 
 
 
14
 
15
  # resample to 16hz
16
  data_16hz = librosa.resample(data[:,0].astype(np.float32),sr,16000)
 
10
  model = Wav2Vec2ForCTC.from_pretrained("aditii09/facebook_english_asr")
11
 
12
  def speech2text(audio):
13
+ if isinstance(audio, tuple) and len(audio) == 2:
14
+ sr, data = audio
15
+ else:
16
+ raise ValueError("Invalid audio format. Expected (sr, data) tuple.")
17
 
18
  # resample to 16hz
19
  data_16hz = librosa.resample(data[:,0].astype(np.float32),sr,16000)