Spaces:
Runtime error
Runtime error
ahmedJaafari
commited on
Commit
·
cdc69af
1
Parent(s):
3c850b8
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ processor = Wav2Vec2ProcessorWithLM.from_pretrained("ahmedJaafari/Annarabic3.2",
|
|
14 |
model = AutoModelForCTC.from_pretrained("ahmedJaafari/Annarabic3.2", cache_dir=cache_dir, use_auth_token=st.secrets["AnnarabicToken"])
|
15 |
|
16 |
# define function to read in sound file
|
17 |
-
def speech_file_to_array_fn(path, max_seconds=
|
18 |
batch = {"file": path}
|
19 |
speech_array, sampling_rate = torchaudio.load(batch["file"])
|
20 |
if sampling_rate != 16000:
|
@@ -44,8 +44,8 @@ def inference(audio):
|
|
44 |
logits = model(input_values).logits
|
45 |
|
46 |
output = processor.decode(logits.numpy()[0]).text
|
47 |
-
print(output)
|
48 |
|
|
|
49 |
return output
|
50 |
|
51 |
inputs = gr.inputs.Audio(label="Record Audio", source="microphone", type='file')
|
|
|
14 |
model = AutoModelForCTC.from_pretrained("ahmedJaafari/Annarabic3.2", cache_dir=cache_dir, use_auth_token=st.secrets["AnnarabicToken"])
|
15 |
|
16 |
# define function to read in sound file
|
17 |
+
def speech_file_to_array_fn(path, max_seconds=60):
|
18 |
batch = {"file": path}
|
19 |
speech_array, sampling_rate = torchaudio.load(batch["file"])
|
20 |
if sampling_rate != 16000:
|
|
|
44 |
logits = model(input_values).logits
|
45 |
|
46 |
output = processor.decode(logits.numpy()[0]).text
|
|
|
47 |
|
48 |
+
print(output)
|
49 |
return output
|
50 |
|
51 |
inputs = gr.inputs.Audio(label="Record Audio", source="microphone", type='file')
|