File size: 541 Bytes
5d20072
dea462a
 
 
1a2e1f9
 
5d20072
 
1a2e1f9
5d20072
 
d344ece
 
 
dea462a
 
1a2e1f9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)