Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,12 @@
|
|
1 |
-
|
2 |
import gradio as gr
|
|
|
3 |
|
4 |
-
|
|
|
5 |
|
|
|
6 |
def transcribe(audio):
|
7 |
-
return whisper(audio)
|
8 |
|
9 |
-
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
# Load the Whisper model using the pipeline from transformers
|
5 |
+
whisper = pipeline("automatic-speech-recognition", model="Futuresony/whisper-small-sw")
|
6 |
|
7 |
+
# Define the transcription function
|
8 |
def transcribe(audio):
|
9 |
+
return whisper(audio)["text"]
|
10 |
|
11 |
+
# Create the Gradio interface
|
12 |
+
gr.Interface(fn=transcribe, inputs=gr.Audio(type="filepath"), outputs=gr.Textbox()).launch()
|