import streamlit as st # main header st.title("SongScope") # web app explainer st.write("Welcome to SongScope. This is a web app that lets you download lyrics and metadata of your favourite artist.\n") st.write("Enter an artist name, and you can even select up to 5 songs to retrieve their data. If you don't specify any songs,\ndata on all songs by the artist will be retrieved.") # user-provided data artist_name = st.text_input("Enter artist name here") song_1 = st.text_input("Enter 1st song title here") song_2 = st.text_input("Enter 2nd song title here") song_3 = st.text_input("Enter 3rd song title here") song_4 = st.text_input("Enter 4th song title here") song_5 = st.text_input("Enter 5th song title here") # data is found ################################################################# # PUT GET DATA FUNCTION HERE ################################################################# # user downloads found data here csv_dl_button = st.download_button('Download Data', DATA_TO_CSV, 'text/csv') # st.download_button('Download Data', DATA_TO_CSV) # Defaults to 'text/plain' with open(f'{artist_name.lower()}_data.csv') as f: st.download_button('Download CSV', f) # Defaults to 'text/plain' st.write("Your data should now be downloading.") # fun facts fun_fax = [] with open("fun_fax.txt", "r", encoding = "utf-8") as f: for word in f.read().split("\n"): if len(word) == 5: fun_fax.append(word) f.close() # closes connection to file st.write(fun_fax[random.randint(0, len(fun_fax) - 1)]) # "thank you" blurb st.write("\nThanks for checking out Wordle Wizard! If you have any feedback or requests for additions to this app, shoot me an email at kmaurinjones@gmail.com.")