awacke1 commited on
Commit
c4e4c6d
1 Parent(s): 7ab71f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -36,9 +36,9 @@ def process_line(line):
36
  line = re.sub(r'\b([A-G][#b]?m?)\b', r"<img src='\1.png' style='height:20px;'>", line)
37
  return line
38
 
39
- def process_chord_sheet(chord_sheet):
40
  processed_lines = []
41
- for line in chord_sheet.split('\n'):
42
  processed_line = process_line(line)
43
  processed_lines.append(processed_line)
44
  return '<br>'.join(processed_lines)
@@ -84,15 +84,15 @@ def main():
84
 
85
  # Chord Sheet Section
86
  with col2:
87
- st.title("Chord Sheet Manager")
88
 
89
  all_files = [f for f in glob.glob("*.txt") if ' by ' in f]
90
- selected_file = st.selectbox("Choose a Song:", all_files)
91
 
92
  if selected_file:
93
  with open(selected_file, 'r', encoding='utf-8') as file:
94
- chord_sheet = file.read()
95
- st.markdown(process_chord_sheet(chord_sheet), unsafe_allow_html=True)
96
 
97
  # Trigger a rerun only when the snapshot interval is reached
98
  if 'last_captured' in st.session_state and time.time() - st.session_state['last_captured'] > snapshot_interval:
 
36
  line = re.sub(r'\b([A-G][#b]?m?)\b', r"<img src='\1.png' style='height:20px;'>", line)
37
  return line
38
 
39
+ def process_sheet(sheet):
40
  processed_lines = []
41
+ for line in sheet.split('\n'):
42
  processed_line = process_line(line)
43
  processed_lines.append(processed_line)
44
  return '<br>'.join(processed_lines)
 
84
 
85
  # Chord Sheet Section
86
  with col2:
87
+ st.title("Insight Datasets")
88
 
89
  all_files = [f for f in glob.glob("*.txt") if ' by ' in f]
90
+ selected_file = st.selectbox("Choose a Dataset:", all_files)
91
 
92
  if selected_file:
93
  with open(selected_file, 'r', encoding='utf-8') as file:
94
+ sheet = file.read()
95
+ st.markdown(process_sheet(sheet), unsafe_allow_html=True)
96
 
97
  # Trigger a rerun only when the snapshot interval is reached
98
  if 'last_captured' in st.session_state and time.time() - st.session_state['last_captured'] > snapshot_interval: