fabianzeiher commited on
Commit
0cc869c
·
1 Parent(s): c939a1a

updated interface to include non fine-tuned model

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -1,17 +1,22 @@
1
  from transformers import pipeline
2
  import gradio as gr
3
 
4
- pipe = pipeline(model="openai/whisper-small") # change to "your-username/the-name-you-picked"
 
5
 
6
  def transcribe(audio):
7
- text = pipe(audio)["text"]
8
- return text
 
 
 
9
 
10
  iface = gr.Interface(
11
  fn=transcribe,
12
- inputs=gr.Audio(sources=["microphone"], type="filepath"),
13
- outputs="text",
14
- title="Whisper Small Swedish",
 
15
  description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",
16
  )
17
 
 
1
  from transformers import pipeline
2
  import gradio as gr
3
 
4
+ pipe_fine = pipeline(model="zeihers-mart/whisper-small-swedish-basic")
5
+ pipe_raw = pipeline(model="openai/whisper-small")
6
 
7
  def transcribe(audio):
8
+ text_sv = pipe_fine(audio)["text"]
9
+ print(f"Audio transcribed: {text_sv}")
10
+ text_raw= pipe_raw(audio)["text"]
11
+ print(f"Text translated: {text_raw}")
12
+ return text_sv, text_raw
13
 
14
  iface = gr.Interface(
15
  fn=transcribe,
16
+ inputs=gr.Audio(source="microphone", type="filepath"),
17
+ outputs=[gr.Textbox(label="Fine-tuned transcription"),
18
+ gr.Textbox(label="Whisper Transcription")],
19
+ title="Finetuned Whisper Swedish Small",
20
  description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",
21
  )
22