kmaurinjones commited on
Commit
e665916
1 Parent(s): c43be04

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -2
app.py CHANGED
@@ -1,4 +1,44 @@
1
  import streamlit as st
2
 
3
- x = st.slider('Select a value')
4
- st.write(x, 'squared is', x * x)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
 
3
+ # main header
4
+ st.title("SongScope")
5
+
6
+ # web app explainer
7
+ st.write("Welcome to SongScope. This is a web app that lets you download lyrics and metadata of your favourite artist.\n")
8
+ 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.")
9
+
10
+ # user-provided data
11
+ artist_name = st.text_input("Enter artist name here")
12
+ song_1 = st.text_input("Enter 1st song title here")
13
+ song_2 = st.text_input("Enter 2nd song title here")
14
+ song_3 = st.text_input("Enter 3rd song title here")
15
+ song_4 = st.text_input("Enter 4th song title here")
16
+ song_5 = st.text_input("Enter 5th song title here")
17
+
18
+ # data is found
19
+ #################################################################
20
+
21
+ # PUT GET DATA FUNCTION HERE
22
+
23
+ #################################################################
24
+
25
+ # user downloads found data here
26
+ csv_dl_button = st.download_button('Download Data', DATA_TO_CSV, 'text/csv')
27
+ # st.download_button('Download Data', DATA_TO_CSV) # Defaults to 'text/plain'
28
+
29
+ with open(f'{artist_name.lower()}_data.csv') as f:
30
+ st.download_button('Download CSV', f) # Defaults to 'text/plain'
31
+ st.write("Your data should now be downloading.")
32
+
33
+ # fun facts
34
+ fun_fax = []
35
+ with open("fun_fax.txt", "r", encoding = "utf-8") as f:
36
+ for word in f.read().split("\n"):
37
+ if len(word) == 5:
38
+ fun_fax.append(word)
39
+ f.close() # closes connection to file
40
+
41
+ st.write(fun_fax[random.randint(0, len(fun_fax) - 1)])
42
+
43
+ # "thank you" blurb
44
+ 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.")