Spaces:
Sleeping
Sleeping
Create app.py from local
Browse files
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()
|