Ojobo commited on
Commit
66bea31
Β·
verified Β·
1 Parent(s): a5348d3

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+ import time
4
+
5
+
6
+ p = pipeline("automatic-speech-recognition")
7
+
8
+ def transcribe(audio, state=""):
9
+ time.sleep(3)
10
+ text = p(audio)["text"]
11
+ state += text + " "
12
+ return state, state
13
+
14
+ gr.Interface(
15
+ fn=transcribe,
16
+ inputs=[
17
+ gr.inputs.Audio(source="microphone", type="filepath"),
18
+ 'state'
19
+ ],
20
+ outputs=[
21
+ "textbox",
22
+ "state"
23
+ ],
24
+ live=True).launch()
25
+