GuillermoPuma commited on
Commit
b130f29
1 Parent(s): ed07a71
Files changed (2) hide show
  1. app.py +6 -4
  2. requirements.txt +2 -1
app.py CHANGED
@@ -1,16 +1,18 @@
1
  from huggingsound import SpeechRecognitionModel
 
2
  import gradio as gr
3
 
4
 
5
- model = SpeechRecognitionModel("patrickvonplaten/wav2vec2-large-xlsr-53-spanish-with-lm")
 
6
 
7
 
8
  def transcribe(audio, state=""):
9
- transcriptions_es = model.transcribe([audio])[0]
 
10
  # Algoritmo here
11
-
12
  recomendacion = "definir variable"
13
- return transcriptions_es['transcription'], recomendacion
14
 
15
  inputs = gr.inputs.Audio(label="Dar click para escuchar tu voz", type="filepath", source="microphone")
16
  output1 = gr.outputs.Textbox(label="Asi se ve tu código")
 
1
  from huggingsound import SpeechRecognitionModel
2
+ from transformers import pipeline
3
  import gradio as gr
4
 
5
 
6
+ #model = SpeechRecognitionModel("patrickvonplaten/wav2vec2-large-xlsr-53-spanish-with-lm")
7
+ pipe = pipeline("automatic-speech-recognition", "patrickvonplaten/wav2vec2-large-xlsr-53-spanish-with-lm")
8
 
9
 
10
  def transcribe(audio, state=""):
11
+ #transcriptions_es = model.transcribe([audio])[0]
12
+ transcriptions_es = pipe(audio)["text"]
13
  # Algoritmo here
 
14
  recomendacion = "definir variable"
15
+ return transcriptions_es, recomendacion
16
 
17
  inputs = gr.inputs.Audio(label="Dar click para escuchar tu voz", type="filepath", source="microphone")
18
  output1 = gr.outputs.Textbox(label="Asi se ve tu código")
requirements.txt CHANGED
@@ -1,2 +1,3 @@
1
  gradio
2
- huggingsound
 
 
1
  gradio
2
+ huggingsound
3
+ transformers