Spaces:
Sleeping
Sleeping
File size: 1,039 Bytes
69a9bd1 5845aec f8dd39f 69a9bd1 8ed4df7 69a9bd1 5845aec b1c4543 5845aec 69a9bd1 5845aec 66fd747 69a9bd1 16cbef9 b08ff31 69a9bd1 f8dd39f 69a9bd1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
from transformers import pipeline
import gradio as gr
from song_guesser import SongGuesser
from list_songs import ListSongs
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!",
)
markdown_text = "The songs that we can guess are: \n" + ListSongs.get_song_list()
iface.add_component(gr.Markdown(markdown_text))
iface.launch() |