Update app.py
Browse files
app.py
CHANGED
@@ -5,9 +5,11 @@ import os
|
|
5 |
|
6 |
pipe = pipeline(task="automatic-speech-recognition", model="geokanaan/Whisper_Base_Lebanese_Arabizi")
|
7 |
def transcribe(audio):
|
8 |
-
|
9 |
-
|
|
|
10 |
|
|
|
11 |
|
12 |
HF_TOKEN = os.getenv('WRITE')
|
13 |
#hf_writer = gr.HuggingFaceDatasetSaver(HF_TOKEN, "geokanaan/flagged_Audio_Lebanese")
|
@@ -15,7 +17,7 @@ HF_TOKEN = os.getenv('WRITE')
|
|
15 |
iface = gr.Interface(
|
16 |
fn=transcribe,
|
17 |
inputs=[
|
18 |
-
gr.Audio(sources="microphone"
|
19 |
],
|
20 |
outputs="text",
|
21 |
title="arabeasy",
|
|
|
5 |
|
6 |
pipe = pipeline(task="automatic-speech-recognition", model="geokanaan/Whisper_Base_Lebanese_Arabizi")
|
7 |
def transcribe(audio):
|
8 |
+
sr, y = audio
|
9 |
+
y = y.astype(np.float32)
|
10 |
+
y /= np.max(np.abs(y))
|
11 |
|
12 |
+
return pipe({"sampling_rate": sr, "raw": y})["text"]
|
13 |
|
14 |
HF_TOKEN = os.getenv('WRITE')
|
15 |
#hf_writer = gr.HuggingFaceDatasetSaver(HF_TOKEN, "geokanaan/flagged_Audio_Lebanese")
|
|
|
17 |
iface = gr.Interface(
|
18 |
fn=transcribe,
|
19 |
inputs=[
|
20 |
+
gr.Audio(sources="microphone")
|
21 |
],
|
22 |
outputs="text",
|
23 |
title="arabeasy",
|