Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
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)
|