awacke1 commited on
Commit
6f681ea
1 Parent(s): 143b8df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -23
app.py CHANGED
@@ -37,7 +37,7 @@ def main():
37
  with st.sidebar:
38
  st.title('🎵 Song Files')
39
  with st.expander("Select Song File", expanded=True):
40
- all_files = [f for f in glob.glob("*.txt") if 'by' in f]
41
  selected_file = st.selectbox("Choose a file", all_files)
42
  if selected_file:
43
  song_name, artist_name = os.path.splitext(selected_file)[0].split(' by ')
@@ -61,37 +61,37 @@ def main():
61
  st.success("Chord sheet saved.")
62
  else:
63
  st.error("Both Song Name and Artist Name are required.")
64
-
65
  with col2:
66
  if selected_file:
67
  load_song_file(selected_file)
68
  song_info = os.path.splitext(selected_file)[0].replace("_", " ")
69
  st.markdown(f"**Selected Song:** {song_info}")
70
  st.markdown(f"[📚Wikipedia]({create_search_url_wikipedia(song_info)})")
71
- st.markdown(f"🎥YouTube")
72
- st.markdown(f"🎸Chords")
73
- st.markdown(f"🎶Lyrics")
74
 
75
- st.header("🎼 Available Songs")
76
- for file in all_files:
77
- song_info = os.path.splitext(file)[0].replace("_", " ")
78
- col1, col2, col3, col4, col5 = st.columns([4, 1, 1, 1, 1])
79
- with col1:
80
- st.markdown(f"* {song_info}")
81
- with col2:
82
- st.markdown(f"[📚Wikipedia]({create_search_url_wikipedia(song_info)})")
83
- with col3:
84
- st.markdown(f"[🎥YouTube]({create_search_url_youtube(song_info)})")
85
- with col4:
86
- st.markdown(f"[🎸Chords]({create_search_url_chords(song_info)})")
87
- with col5:
88
- st.markdown(f"[🎶Lyrics]({create_search_url_lyrics(song_info)})")
89
 
90
  def load_song_file(filename):
91
  with open(filename, "r") as file:
92
  chord_sheet = file.read()
93
- st.text_area("Chord Sheet", chord_sheet, height=300)
94
- processed_sheet = process_chord_sheet(chord_sheet)
95
- st.markdown(processed_sheet, unsafe_allow_html=True)
96
 
97
- main()
 
 
37
  with st.sidebar:
38
  st.title('🎵 Song Files')
39
  with st.expander("Select Song File", expanded=True):
40
+ all_files = [f for f in glob.glob("*.txt") if ' by ' in f]
41
  selected_file = st.selectbox("Choose a file", all_files)
42
  if selected_file:
43
  song_name, artist_name = os.path.splitext(selected_file)[0].split(' by ')
 
61
  st.success("Chord sheet saved.")
62
  else:
63
  st.error("Both Song Name and Artist Name are required.")
 
64
  with col2:
65
  if selected_file:
66
  load_song_file(selected_file)
67
  song_info = os.path.splitext(selected_file)[0].replace("_", " ")
68
  st.markdown(f"**Selected Song:** {song_info}")
69
  st.markdown(f"[📚Wikipedia]({create_search_url_wikipedia(song_info)})")
70
+ st.markdown(f"[🎥YouTube]({create_search_url_youtube(song_info)})")
71
+ st.markdown(f"[🎸Chords]({create_search_url_chords(song_info)})")
72
+ st.markdown(f"[🎶Lyrics]({create_search_url_lyrics(song_info)})")
73
 
74
+ st.header("🎼 Available Songs")
75
+ for file in all_files:
76
+ song_info = os.path.splitext(file)[0].replace("_", " ")
77
+ col1, col2, col3, col4, col5 = st.columns([4, 1, 1, 1, 1])
78
+ with col1:
79
+ st.markdown(f"* {song_info}")
80
+ with col2:
81
+ st.markdown(f"[📚Wikipedia]({create_search_url_wikipedia(song_info)})")
82
+ with col3:
83
+ st.markdown(f"[🎥YouTube]({create_search_url_youtube(song_info)})")
84
+ with col4:
85
+ st.markdown(f"[🎸Chords]({create_search_url_chords(song_info)})")
86
+ with col5:
87
+ st.markdown(f"[🎶Lyrics]({create_search_url_lyrics(song_info)})")
88
 
89
  def load_song_file(filename):
90
  with open(filename, "r") as file:
91
  chord_sheet = file.read()
92
+ st.text_area("Chord Sheet", chord_sheet, height=300)
93
+ processed_sheet = process_chord_sheet(chord_sheet)
94
+ st.markdown(processed_sheet, unsafe_allow_html=True)
95
 
96
+ if __name__ == '__main__':
97
+ main()