Spaces:
Running
Running
sahandkh1419
commited on
Commit
β’
431feaa
1
Parent(s):
2306856
Update app.py
Browse files
app.py
CHANGED
@@ -100,11 +100,11 @@ with tab1:
|
|
100 |
st.markdown('<style>div.stAlert { background-color: rgba(241, 36, 36, 0.9); }</style>', unsafe_allow_html=True)
|
101 |
|
102 |
|
103 |
-
def take_challenge(music_file, typed_lyrics):
|
104 |
st.write('------')
|
105 |
st.write("Listen to music since you have to record 15seconds after that")
|
106 |
st.audio(music_file)
|
107 |
-
audio_value = st.experimental_audio_input("Sing Rest of music:ποΈ")
|
108 |
if audio_value:
|
109 |
with open("user_sing.mp3", "wb") as f:
|
110 |
f.write(audio_value.getbuffer())
|
@@ -139,11 +139,11 @@ with tab2:
|
|
139 |
trimmed_audio.export("trimmed_music.mp3", format="mp3")
|
140 |
st.write("Now type what user should sing:")
|
141 |
typed_lyrics = st.text_area("Lyrics to be singed:")
|
142 |
-
take_challenge("trimmed_music.mp3", typed_lyrics)
|
143 |
else:
|
144 |
st.error('Start Time should be smaller than End Time!', icon="β")
|
145 |
st.markdown('<style>div.stAlert { background-color: rgba(241, 36, 36, 0.9); }</style>', unsafe_allow_html=True)
|
146 |
else:
|
147 |
st.write("Now type what user should sing:")
|
148 |
typed_lyrics = st.text_area("Lyrics to be singed:")
|
149 |
-
take_challenge("raw_music.mp3", typed_lyrics)
|
|
|
100 |
st.markdown('<style>div.stAlert { background-color: rgba(241, 36, 36, 0.9); }</style>', unsafe_allow_html=True)
|
101 |
|
102 |
|
103 |
+
def take_challenge(music_file, typed_lyrics, key):
|
104 |
st.write('------')
|
105 |
st.write("Listen to music since you have to record 15seconds after that")
|
106 |
st.audio(music_file)
|
107 |
+
audio_value = st.experimental_audio_input("Sing Rest of music:ποΈ", key)
|
108 |
if audio_value:
|
109 |
with open("user_sing.mp3", "wb") as f:
|
110 |
f.write(audio_value.getbuffer())
|
|
|
139 |
trimmed_audio.export("trimmed_music.mp3", format="mp3")
|
140 |
st.write("Now type what user should sing:")
|
141 |
typed_lyrics = st.text_area("Lyrics to be singed:")
|
142 |
+
take_challenge("trimmed_music.mp3", typed_lyrics, "unique_key_1")
|
143 |
else:
|
144 |
st.error('Start Time should be smaller than End Time!', icon="β")
|
145 |
st.markdown('<style>div.stAlert { background-color: rgba(241, 36, 36, 0.9); }</style>', unsafe_allow_html=True)
|
146 |
else:
|
147 |
st.write("Now type what user should sing:")
|
148 |
typed_lyrics = st.text_area("Lyrics to be singed:")
|
149 |
+
take_challenge("raw_music.mp3", typed_lyrics, "unique_key_2")
|