Devion333 commited on
Commit
4fbd721
·
verified ·
1 Parent(s): 4543db6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -7
app.py CHANGED
@@ -1,19 +1,25 @@
1
  import os
2
  os.environ["TRANSFORMERS_NO_TF"] = "1"
 
3
  from transformers import pipeline
4
  import gradio as gr
5
 
6
- pipe = pipeline(model="Devion333/wav2vec2-xls-r-300m-dv")
 
 
 
 
7
 
8
  def transcribe(audio):
9
- text = pipe(audio)["text"]
10
- return text
11
 
12
  demo = gr.Interface(
13
  fn=transcribe,
14
- inputs=gr.Audio(sources=["microphone","upload"], type="filepath"),
15
  outputs="text",
16
- title="Whisper Small Demo",
17
- description="Realtime demo for English speech recognition, powered by the open-source Whisper model.",
18
  )
19
- demo.launch()
 
 
 
1
  import os
2
  os.environ["TRANSFORMERS_NO_TF"] = "1"
3
+
4
  from transformers import pipeline
5
  import gradio as gr
6
 
7
+ # Explicitly define the task so HF knows it's ASR
8
+ pipe = pipeline(
9
+ task="automatic-speech-recognition",
10
+ model="Devion333/wav2vec2-xls-r-300m-dv"
11
+ )
12
 
13
  def transcribe(audio):
14
+ return pipe(audio)["text"]
 
15
 
16
  demo = gr.Interface(
17
  fn=transcribe,
18
+ inputs=gr.Audio(sources=["microphone", "upload"], type="filepath"),
19
  outputs="text",
20
+ title="Wav2Vec2 ASR Demo",
21
+ description="Realtime demo for English speech recognition using Devion333/wav2vec2-xls-r-300m-dv."
22
  )
23
+
24
+ if __name__ == "__main__":
25
+ demo.launch()