antonbol commited on
Commit
09ec697
·
1 Parent(s): 4db7dc5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -1,10 +1,10 @@
1
  from transformers import pipeline
2
  import gradio as gr
3
- import glob
4
  pipe = pipeline(model="fimster/whisper-small-sv-SE") # change to "your-username/the-name-you-picked"
5
  images = ["katt", "melon", "hund", "banan"]
6
- print(glob.glob("./images/"))
7
-
8
  def transcribe(audio):
9
  text = pipe(audio)["text"]
10
  return text
@@ -12,8 +12,6 @@ def transcribe(audio):
12
  iface = gr.Interface(
13
  fn=transcribe,
14
  inputs=gr.Audio(source="microphone", type="filepath"),
15
- # image =
16
- # image = gr.Image(),
17
  outputs="text",
18
  title="Whisper Small Swedish",
19
  description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",
 
1
  from transformers import pipeline
2
  import gradio as gr
3
+ from numpy import random
4
  pipe = pipeline(model="fimster/whisper-small-sv-SE") # change to "your-username/the-name-you-picked"
5
  images = ["katt", "melon", "hund", "banan"]
6
+ image = random.choice(images)
7
+ image = gr.Image("./images/" + image + ".jpeg")
8
  def transcribe(audio):
9
  text = pipe(audio)["text"]
10
  return text
 
12
  iface = gr.Interface(
13
  fn=transcribe,
14
  inputs=gr.Audio(source="microphone", type="filepath"),
 
 
15
  outputs="text",
16
  title="Whisper Small Swedish",
17
  description="Realtime demo for Swedish speech recognition using a fine-tuned Whisper small model.",