MarieGotthardt commited on
Commit
b4666e4
·
1 Parent(s): 7bc05d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -1,18 +1,24 @@
1
  from transformers import pipeline
2
  import gradio as gr
 
3
 
4
- pipe = pipeline(model="MarieGotthardt/whisper_tuned") # 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
 
18
  iface.launch()
 
1
  from transformers import pipeline
2
  import gradio as gr
3
+ from song_guesser import SongGuesser
4
 
5
+ pipe = pipeline(model="SamuelHarner/whisper-tuned") # change to "your-username/the-name-you-picked"
6
 
7
  def transcribe(audio):
8
  text = pipe(audio)["text"]
9
  return text
10
 
11
+ def get_song_guess(audio):
12
+ user_query = transcribe(audio)
13
+ output = "Vad vi hörde från dig: " + user_query + "\n\nVi tror att du sjöng: " + SongGuesser.guess_song(user_query)
14
+ return output
15
+
16
  iface = gr.Interface(
17
+ fn=get_song_guess,
18
  inputs=gr.Audio(sources=["microphone"], type="filepath"),
19
  outputs="text",
20
+ title="Sjung en sång och låt oss gissa 🎤 🎄",
21
+ description="Sing a Swedish Christmas song and see if we can guess it. If our guess is wrong, try singing more clearly, more of the lyrics, or another song and maybe we will get it the next time!",
22
  )
23
 
24
  iface.launch()