Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,24 +1,21 @@
|
|
1 |
import gradio as gr
|
2 |
-
import torch
|
3 |
from transformers import pipeline
|
4 |
|
5 |
-
# Load Whisper
|
6 |
-
asr = pipeline("automatic-speech-recognition", model="openai/whisper-
|
7 |
|
8 |
-
#
|
9 |
def transcribe(audio):
|
10 |
-
|
11 |
-
text = asr(audio)["text"]
|
12 |
-
return text
|
13 |
|
14 |
-
#
|
15 |
-
|
16 |
fn=transcribe,
|
17 |
-
inputs=gr.Audio(
|
18 |
outputs="text",
|
19 |
-
title="
|
20 |
-
description="
|
21 |
)
|
22 |
|
23 |
# Launch the app
|
24 |
-
|
|
|
1 |
import gradio as gr
|
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Load Whisper ASR pipeline
|
5 |
+
asr = pipeline("automatic-speech-recognition", model="openai/whisper-base")
|
6 |
|
7 |
+
# Transcription function
|
8 |
def transcribe(audio):
|
9 |
+
return asr(audio)["text"]
|
|
|
|
|
10 |
|
11 |
+
# Gradio interface
|
12 |
+
interface = gr.Interface(
|
13 |
fn=transcribe,
|
14 |
+
inputs=gr.Audio(type="filepath", label="Upload or Record Audio"),
|
15 |
outputs="text",
|
16 |
+
title="Whisper ASR Voice Recognition",
|
17 |
+
description="Transcribe speech using OpenAI's Whisper model."
|
18 |
)
|
19 |
|
20 |
# Launch the app
|
21 |
+
interface.launch()
|