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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -25
app.py CHANGED
@@ -45,31 +45,31 @@ def main():
45
  artist_name = artist_name.replace("_", " ")
46
  else:
47
  song_name, artist_name = "", ""
48
-
49
- col1, col2 = st.columns([2, 1])
50
-
51
- with col1:
52
- with st.expander("🎶 Song and Artist", expanded=True):
53
- song_name_input = st.text_input("🎵 Song Name", value=song_name)
54
- artist_name_input = st.text_input("🎤 Artist Name", value=artist_name)
55
- chord_sheet_input = st.text_area("Chord Sheet", height=300)
56
- if st.button("💾 Save", key="save_song"):
57
- if song_name_input and artist_name_input:
58
- filename = f"{song_name_input} by {artist_name_input}.txt".replace(" ", "_")
59
- with open(filename, "w") as file:
60
- file.write(chord_sheet_input)
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:
 
45
  artist_name = artist_name.replace("_", " ")
46
  else:
47
  song_name, artist_name = "", ""
48
+
49
+ col1, col2 = st.columns([2, 1])
50
+
51
+ with col1:
52
+ with st.expander("🎶 Song and Artist", expanded=True):
53
+ song_name_input = st.text_input("🎵 Song Name", value=song_name)
54
+ artist_name_input = st.text_input("🎤 Artist Name", value=artist_name)
55
+ chord_sheet_input = st.text_area("Chord Sheet", height=300)
56
+ if st.button("💾 Save", key="save_song"):
57
+ if song_name_input and artist_name_input:
58
+ filename = f"{song_name_input} by {artist_name_input}.txt".replace(" ", "_")
59
+ with open(filename, "w") as file:
60
+ file.write(chord_sheet_input)
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: