Create a fun and interactive music player where users can:
Choose music based on their current mood
Click a button to play a song (via YouTube or Spotify link)
Automatically track how many times each song has been played
See which songs are the most popular using charts
Use a radio button or sidebar selection to let users pick a mood:
['Happy', 'Gospel', 'Study', 'Family'] etc
Each mood will display a curated list of songs with:
A thumbnail or album cover
A short description (artist and duration)
A Play button
Use columns to arrange songs in a grid. For each song:
st.image('album_cover_url.jpg')
st.write('Song Title - Artist')
st.success('3:45')
if st.button('Play Song', key='unique_key'):
webbrowser.open('https://youtube.com/your_song_link')
Create or load a CSV file that looks like this:
Happy Song 1 | Chill Song 1 | Study Song 1 | Workout Song 1 |
---|---|---|---|
3 | 5 | 2 | 4 |
Whenever a song is played, increase its count:
videolink.loc[0, 'Happy Song 1'] += 1
videolink.to_csv(videourl, index=False)
Melt the CSV and display as a bar chart or pie chart using Plotly:
melted = videolink.melt(var_name='Song', value_name='Plays')
fig = px.bar(melted, x='Song', y='Plays', title='Most Played Songs')
st.plotly_chart(fig)
We’re always looking for international STEM educators to join our team. If you are interested, please send us a mail and we’ll get back to you!
If you have any questions, kindly send us a mail. Don’t forget to follow and like all our social accounts to get updates on competitions!