cportoca commited on
Commit
92a85b4
·
verified ·
1 Parent(s): a0c4778

Update app.py

Browse files

App.py updated to include the model and audio system

Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -1,7 +1,18 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ pipe = pipeline("automatic-speech-recognition", model="cportoca/CS224S_Quechua_Project_Bilingual")
 
5
 
6
+ def transcribe(audio):
7
+ text = pipe(audio)["text"]
8
+ return text
9
+
10
+ interface = gr.Interface(
11
+ fn=transcribe,
12
+ inputs=gr.Audio(sources="microphone", type="filepath"),
13
+ outputs="text",
14
+ title="Quechua Speech Recognition Demo",
15
+ description="Realtime demo for Yoruba speech recognition using a fine-tuned Wav2Vec-Bert model. NOTE: If you get an error after pressing submit, give the audio some secs to load then try again."
16
+ )
17
+
18
+ interface.launch()