lotrlol commited on
Commit
35da9aa
1 Parent(s): 6961acc

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +21 -10
main.py CHANGED
@@ -52,16 +52,27 @@ def play_recomm():
52
  st.error('Model failed. Check the log for more information.')
53
 
54
  def art_recomm():
55
- if 'rs' in st.session_state:
56
- del st.session_state.rs,st.session_state.err
57
- with st.spinner('Getting Recommendations...'):
58
- res,err = top_tracks(st.session_state.a_url,st.session_state.rg)
59
- st.session_state.rs=res
60
- st.session_state.err=err
61
- if len(st.session_state.rs)>=1:
62
- st.success('Go to the Result page to view the top {} recommendations'.format(len(st.session_state.rs)))
63
- else:
64
- st.error('Model failed. Check the log for more information.')
 
 
 
 
 
 
 
 
 
 
 
65
 
66
  def song_recomm():
67
  if 'rs' in st.session_state:
 
52
  st.error('Model failed. Check the log for more information.')
53
 
54
  def art_recomm():
55
+ if 'rs' in st.session_state:
56
+ st.write("Session state is present")
57
+ feature = st.selectbox("Select a feature:", ["Playlist", "Artist", "Song"], index=0)
58
+ st.write("You have selected: ", feature)
59
+ if feature == "Playlist":
60
+ st.write("Note: For Playlist-based recommendations, please use public playlists only.")
61
+ #code to get recommendations based on the playlist name
62
+ elif feature == "Artist":
63
+ artist_name = st.text_input("Enter artist name")
64
+ if artist_name:
65
+ get_artist_recommendations(artist_name)
66
+ else:
67
+ st.write("Please enter a valid artist name")
68
+ elif feature == "Song":
69
+ st.write("Note: For Song-based recommendations, Spotify model will be used by default.")
70
+ # code to get recommendations based on the song name
71
+ else:
72
+ st.write("Please select a valid feature")
73
+ else:
74
+ st.write("Session state is not present")
75
+
76
 
77
  def song_recomm():
78
  if 'rs' in st.session_state: