whisper-swedish / app.py
SamuelHarner's picture
Update app.py
8ed4df7
raw
history blame
No virus
874 Bytes
from transformers import pipeline
import gradio as gr
from song_guesser import SongGuesser
pipe = pipeline(model="SamuelHarner/whisper-tuned") # change to "your-username/the-name-you-picked"
def transcribe(audio):
text = pipe(audio)["text"]
return text
def get_song_guess(audio):
user_query = transcribe(audio)
output = "Vad vi hörde från dig: " + user_query + "\n\nVi tror att du sjöng: " + SongGuesser.guess_song(user_query)
return output
iface = gr.Interface(
fn=get_song_guess,
inputs=gr.Audio(sources=["microphone"], type="filepath"),
outputs="text",
title="Sjung en sång och låt oss gissa 🎤 🎄",
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!",
)
iface.launch()