geokanaan commited on
Commit
788229d
·
1 Parent(s): 2c0f3d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -9
app.py CHANGED
@@ -5,20 +5,15 @@ import os
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")
16
 
17
  iface = gr.Interface(
18
  fn=transcribe,
19
- inputs=[
20
- gr.Audio(sources="microphone")
21
- ],
22
  outputs="text",
23
  title="arabeasy",
24
  description="Realtime demo for Lebanese Arabizi speech recognition",
 
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",