Spaces:
Sleeping
Sleeping
yellowcandle
commited on
Commit
•
e828a9f
1
Parent(s):
f40e275
Add Whisper speech recognition demo using Gradio
Browse files
app.py
CHANGED
@@ -1,11 +1,14 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
# Use a pipeline as a high-level helper
|
3 |
from transformers import pipeline
|
4 |
|
5 |
pipe = pipeline("automatic-speech-recognition", model="openai/whisper-large-v3")
|
6 |
|
|
|
7 |
def transcribe_audio(audio):
|
8 |
return pipe(audio)
|
9 |
|
10 |
-
demo = gr.Interface(fn=transcribe_audio, inputs=gr.Audio(
|
11 |
demo.launch()
|
|
|
|
1 |
+
import spaces
|
2 |
import gradio as gr
|
3 |
# Use a pipeline as a high-level helper
|
4 |
from transformers import pipeline
|
5 |
|
6 |
pipe = pipeline("automatic-speech-recognition", model="openai/whisper-large-v3")
|
7 |
|
8 |
+
@spaces.GPU
|
9 |
def transcribe_audio(audio):
|
10 |
return pipe(audio)
|
11 |
|
12 |
+
demo = gr.Interface(fn=transcribe_audio, inputs=gr.Audio(sources="upload", type="filepath"), outputs="text")
|
13 |
demo.launch()
|
14 |
+
|