Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,11 @@ processor = Wav2Vec2Processor.from_pretrained("maher13/arabic-iti")
|
|
9 |
model = Wav2Vec2ForCTC.from_pretrained("maher13/arabic-iti").eval()
|
10 |
# define function to read in sound file
|
11 |
def map_to_array(file):
|
12 |
-
speech,
|
|
|
|
|
|
|
|
|
13 |
return speech
|
14 |
|
15 |
# tokenize
|
|
|
9 |
model = Wav2Vec2ForCTC.from_pretrained("maher13/arabic-iti").eval()
|
10 |
# define function to read in sound file
|
11 |
def map_to_array(file):
|
12 |
+
speech, sr= sf.read(file)
|
13 |
+
if sr != 16000:
|
14 |
+
transform = torchaudio.transforms.Resample(orig_freq=sampling_rate,
|
15 |
+
new_freq=16000)
|
16 |
+
speech= transform(speech)[0].numpy()
|
17 |
return speech
|
18 |
|
19 |
# tokenize
|