Spaces:
Running
Running
Commit
•
9d24c19
1
Parent(s):
98225a2
Update app.py
Browse files
app.py
CHANGED
@@ -12,15 +12,10 @@ st.write("Welcome to SongScope. This is a web app that lets you download lyrics
|
|
12 |
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.")
|
13 |
|
14 |
# delay times
|
15 |
-
# delay_min = float(st.text_input("Minimum delay per iteration. We recommend a value of at least 10 seconds per song, otherwise you may be banned from azlyrics.com for scraping."))
|
16 |
-
# delay_max = float(st.text_input("Maximum delay per iteration. We recommend a value of at least 10 seconds per song, otherwise you may be banned from azlyrics.com for scraping."))
|
17 |
delay_min = st.number_input(label = "Minimum delay per iteration. We recommend a value of at least 10 seconds per song, otherwise you may be banned from azlyrics.com for scraping.",
|
18 |
step = 1., format = "%.2f")
|
19 |
delay_max = st.number_input(label = "Maximum delay per iteration. We recommend a value of at least 10 seconds per song, otherwise you may be banned from azlyrics.com for scraping.",
|
20 |
step = 1., format = "%.2f")
|
21 |
-
# delay_min = 15
|
22 |
-
# delay_max = 30
|
23 |
-
# sysBP = st.number_input(label=“systolic blood pressure”,step=1.,format="%.2f")
|
24 |
|
25 |
# user-provided data
|
26 |
artist_name = st.text_input("Enter artist name here")
|
@@ -30,6 +25,13 @@ song_3 = st.text_input("Enter 3rd song title here")
|
|
30 |
song_4 = st.text_input("Enter 4th song title here")
|
31 |
song_5 = st.text_input("Enter 5th song title here")
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
# data is found
|
34 |
find_button = st.button('Find Data')
|
35 |
if not find_button: # button to make everything run
|
@@ -39,20 +41,17 @@ else:
|
|
39 |
song_titles = song_1 + song_2 + song_3 + song_4 + song_5,
|
40 |
delay = (delay_min, delay_max), # random float value between (delay_min, delay_max) seconds
|
41 |
print_progress = True)
|
42 |
-
|
|
|
43 |
dl_button = st.download_button('Download Data', artist_df, f"{artist_name.lower()}_data.csv")
|
44 |
if dl_button:
|
45 |
-
st.write("Your data should be
|
46 |
-
|
47 |
-
# funnies
|
48 |
-
funnies = []
|
49 |
-
with open("fun_fax.txt", "r", encoding = "utf-8") as f:
|
50 |
-
for funny in f.read().split("\n"):
|
51 |
-
funnies.append(funny)
|
52 |
-
f.close() # closes connection to file
|
53 |
-
|
54 |
-
# print one fun fact
|
55 |
-
st.write(funnies[random.randint(0, len(funnies) - 1)])
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
# "thank you" blurb
|
58 |
st.write("\nThanks for checking out SongScope! If you have any feedback or requests for additions to this app, shoot me an email at kmaurinjones@gmail.com.")
|
|
|
12 |
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.")
|
13 |
|
14 |
# delay times
|
|
|
|
|
15 |
delay_min = st.number_input(label = "Minimum delay per iteration. We recommend a value of at least 10 seconds per song, otherwise you may be banned from azlyrics.com for scraping.",
|
16 |
step = 1., format = "%.2f")
|
17 |
delay_max = st.number_input(label = "Maximum delay per iteration. We recommend a value of at least 10 seconds per song, otherwise you may be banned from azlyrics.com for scraping.",
|
18 |
step = 1., format = "%.2f")
|
|
|
|
|
|
|
19 |
|
20 |
# user-provided data
|
21 |
artist_name = st.text_input("Enter artist name here")
|
|
|
25 |
song_4 = st.text_input("Enter 4th song title here")
|
26 |
song_5 = st.text_input("Enter 5th song title here")
|
27 |
|
28 |
+
# funnies
|
29 |
+
funnies = []
|
30 |
+
with open("fun_fax.txt", "r", encoding = "utf-8") as f:
|
31 |
+
for funny in f.read().split("\n"):
|
32 |
+
funnies.append(funny)
|
33 |
+
f.close() # closes connection to file
|
34 |
+
|
35 |
# data is found
|
36 |
find_button = st.button('Find Data')
|
37 |
if not find_button: # button to make everything run
|
|
|
41 |
song_titles = song_1 + song_2 + song_3 + song_4 + song_5,
|
42 |
delay = (delay_min, delay_max), # random float value between (delay_min, delay_max) seconds
|
43 |
print_progress = True)
|
44 |
+
|
45 |
+
# download button and download
|
46 |
dl_button = st.download_button('Download Data', artist_df, f"{artist_name.lower()}_data.csv")
|
47 |
if dl_button:
|
48 |
+
st.write("Your data should be downloading. If not, please reload the page and try again.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
+
# fun joke
|
51 |
+
joke_button = st.button("Want to hear a joke while you wait?")
|
52 |
+
if joke_button:
|
53 |
+
st.write(funnies[random.randint(0, len(funnies) - 1)])
|
54 |
+
st.write("Click the button again to get another!")
|
55 |
+
|
56 |
# "thank you" blurb
|
57 |
st.write("\nThanks for checking out SongScope! If you have any feedback or requests for additions to this app, shoot me an email at kmaurinjones@gmail.com.")
|