Futuresony commited on
Commit
c1d2c74
·
verified ·
1 Parent(s): f4cd8f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -1,9 +1,12 @@
1
-
2
  import gradio as gr
 
3
 
4
- whisper = gr.load("Futuresony/whisper-small-sw")
 
5
 
 
6
  def transcribe(audio):
7
- return whisper(audio).replace("AutomaticSpeechRecognitionOutput(text=' ", "").replace("', chunks=None)", "")
8
 
9
- gr.Interface(transcribe, gr.Audio(type="filepath"), gr.Textbox()).launch()
 
 
 
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()