EugenioRoma commited on
Commit
bca4761
Β·
1 Parent(s): 74e9b69

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -7
app.py CHANGED
@@ -1,11 +1,24 @@
 
 
 
1
  import gradio as gr
2
 
3
- titulo='Demo de transcripcion'
4
- description='Este es un demo ejecutado en clase de Platzi'
 
 
5
 
6
- gr.Interface.load(
7
- 'huggingface/facebook/wav2vec2-large-xlsr-53-spanish',
8
- input=[gr.Audio(source='microphone',type='filepath')],
9
- title=titulo,
10
- description=description
 
 
 
 
 
 
 
 
11
  ).launch()
 
1
+ # Let's get pipelines from transformers
2
+ from transformers import pipeline
3
+ # Let's import Gradio
4
  import gradio as gr
5
 
6
+ # Let's set up the model
7
+ model = pipeline("automatic-speech-recognition", model="facebook/wav2vec2-large-xlsr-53-spanish")
8
+ title = "Audio2Text"
9
+ description = "Record your audio in Spanish and send it in order to received a transcription"
10
 
11
+
12
+ # Function
13
+ def transcribe(audio):
14
+ # Let's invoke "model" defined above
15
+ text = model(audio)["text"]
16
+ return text
17
+
18
+
19
+ # Interface Set-Up
20
+ gr.Interface(
21
+ fn=transcribe,
22
+ inputs=[gr.Audio(source="microphone", type="filepath")],
23
+ outputs=["textbox"]
24
  ).launch()