turtlegraphics commited on
Commit
280bf21
·
verified ·
1 Parent(s): d08e82c

Create app.py from local

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # speech recognition
3
+ #
4
+ import numpy as np
5
+ import gradio as gr
6
+ from transformers import pipeline
7
+
8
+ asr = pipeline("automatic-speech-recognition", model="openai/whisper-base")
9
+
10
+ def transcribe(audio):
11
+ english = asr(audio)
12
+ return english['text']
13
+
14
+ demo = gr.Interface(fn = transcribe,
15
+ inputs=gr.Audio(type="filepath"),
16
+ outputs = "text",
17
+ title = "Whisper Speech Recognition")
18
+
19
+ demo.launch()