ashutoshm2897
commited on
Commit
•
6e29ab5
1
Parent(s):
a85ac8e
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,14 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
|
|
3 |
|
4 |
# Load the Whisper model and pipeline
|
5 |
pipe = pipeline("automatic-speech-recognition", model="openai/whisper-small")
|
6 |
|
7 |
-
def transcribe(
|
8 |
"""Transcribe the audio using the loaded Whisper pipeline."""
|
9 |
-
|
|
|
10 |
return text
|
11 |
|
12 |
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
+
import numpy as np
|
4 |
|
5 |
# Load the Whisper model and pipeline
|
6 |
pipe = pipeline("automatic-speech-recognition", model="openai/whisper-small")
|
7 |
|
8 |
+
def transcribe(audio):
|
9 |
"""Transcribe the audio using the loaded Whisper pipeline."""
|
10 |
+
audio_np = np.frombuffer(audio, dtype=np.int16)
|
11 |
+
text = pipe(audio_np)["text"]
|
12 |
return text
|
13 |
|
14 |
|