Update app.py
Browse files
app.py
CHANGED
@@ -4,20 +4,28 @@ import os
|
|
4 |
|
5 |
|
6 |
pipe = pipeline(task="automatic-speech-recognition", model="geokanaan/Whisper_Base_Lebanese_Arabizi")
|
7 |
-
def transcribe(audio):
|
8 |
-
text = pipe(audio)["text"]
|
9 |
-
return text
|
10 |
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
iface = gr.Interface(
|
15 |
fn=transcribe,
|
16 |
-
inputs=
|
|
|
|
|
|
|
17 |
outputs="text",
|
18 |
title="arabeasy",
|
19 |
description="Realtime demo for Lebanese Arabizi speech recognition",
|
20 |
-
|
21 |
-
|
22 |
)
|
23 |
-
|
|
|
|
4 |
|
5 |
|
6 |
pipe = pipeline(task="automatic-speech-recognition", model="geokanaan/Whisper_Base_Lebanese_Arabizi")
|
|
|
|
|
|
|
7 |
|
8 |
+
|
9 |
+
|
10 |
+
def transcribe(audio, actual_transcription):
|
11 |
+
text = pipe(audio)
|
12 |
+
return text['text']
|
13 |
+
|
14 |
+
|
15 |
+
HF_TOKEN = os.getenv('WRITE')
|
16 |
+
hf_writer = gr.HuggingFaceDatasetSaver(HF_TOKEN, "flagged_Audio_Lebanese")
|
17 |
|
18 |
iface = gr.Interface(
|
19 |
fn=transcribe,
|
20 |
+
inputs=[
|
21 |
+
gr.Audio(source="microphone", type="filepath"),
|
22 |
+
gr.Textbox(label="Actual Transcription", optional=True)
|
23 |
+
],
|
24 |
outputs="text",
|
25 |
title="arabeasy",
|
26 |
description="Realtime demo for Lebanese Arabizi speech recognition",
|
27 |
+
allow_flagging='manual', # Enable manual flagging
|
28 |
+
flagging_callback=hf_writer
|
29 |
)
|
30 |
+
|
31 |
+
iface.launch(share=True)
|