geokanaan commited on
Commit
5cbdb9e
·
1 Parent(s): 5244313

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+ import os
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(sources="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',
28
+ flagging_callback=hf_writer
29
+ )