Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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
|
40 |
processed_lines = []
|
41 |
-
for line in
|
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("
|
88 |
|
89 |
all_files = [f for f in glob.glob("*.txt") if ' by ' in f]
|
90 |
-
selected_file = st.selectbox("Choose a
|
91 |
|
92 |
if selected_file:
|
93 |
with open(selected_file, 'r', encoding='utf-8') as file:
|
94 |
-
|
95 |
-
st.markdown(
|
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:
|