Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -55,12 +55,20 @@ def main():
|
|
55 |
with col1:
|
56 |
song_name_input = st.text_input("π΅ Song Name", value=song_name)
|
57 |
artist_name_input = st.text_input("π€ Artist Name", value=artist_name)
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
if st.button("πΎ Save", key="save_song"):
|
60 |
if song_name_input and artist_name_input:
|
61 |
filename = f"{song_name_input} by {artist_name_input}.txt".replace(" ", "_")
|
62 |
with open(filename, "w") as file:
|
63 |
-
file.write(
|
64 |
st.success("Chord sheet saved.")
|
65 |
else:
|
66 |
st.error("Both Song Name and Artist Name are required.")
|
|
|
55 |
with col1:
|
56 |
song_name_input = st.text_input("π΅ Song Name", value=song_name)
|
57 |
artist_name_input = st.text_input("π€ Artist Name", value=artist_name)
|
58 |
+
|
59 |
+
# Load chord sheet from selected file into the text area
|
60 |
+
chord_sheet_input = ""
|
61 |
+
if selected_file:
|
62 |
+
with open(selected_file, "r") as file:
|
63 |
+
chord_sheet_input = file.read()
|
64 |
+
chord_sheet_area = st.text_area("Chord Sheet", value=chord_sheet_input, height=300)
|
65 |
+
|
66 |
+
# Save functionality
|
67 |
if st.button("πΎ Save", key="save_song"):
|
68 |
if song_name_input and artist_name_input:
|
69 |
filename = f"{song_name_input} by {artist_name_input}.txt".replace(" ", "_")
|
70 |
with open(filename, "w") as file:
|
71 |
+
file.write(chord_sheet_area)
|
72 |
st.success("Chord sheet saved.")
|
73 |
else:
|
74 |
st.error("Both Song Name and Artist Name are required.")
|