geokanaan commited on
Commit
d84fe22
·
1 Parent(s): fe8b729

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -9
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
- #HF_TOKEN = os.getenv('WRITE')
12
- #hf_writer = gr.HuggingFaceDatasetSaver(HF_TOKEN, "geokanaan/flagged_Audio_Lebanese")
 
 
 
 
 
 
 
13
 
14
  iface = gr.Interface(
15
  fn=transcribe,
16
- inputs=gr.Audio(sources="microphone",type = 'filepath'),
 
 
 
17
  outputs="text",
18
  title="arabeasy",
19
  description="Realtime demo for Lebanese Arabizi speech recognition",
20
- #allow_flagging='manual',
21
- #flagging_callback=hf_writer
22
  )
23
- iface.launch()
 
 
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)