MusicChallenge / app.py
sahandkh1419's picture
Update app.py
1a2e1f9 verified
raw
history blame
541 Bytes
import streamlit as st
import whisper
model = whisper.load_model("base")
st.audio("titanic.mp3")
st.write("Please wait for the music to finish before recording the rest of it by your own.")
audio_value = st.experimental_audio_input("Record a voice message")
lyrics = "Far across the distance And spaces between us You have come to show you go on"
if audio_value:
with open("user_sing.mp3", "wb") as f:
f.write(audio_value.getbuffer())
user_lyrics = model.transcribe("user_sing.mp3")["text"]
st.write(user_lyrics)