awacke1 commited on
Commit
1442cce
β€’
1 Parent(s): e12508c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -16,26 +16,27 @@ def process_chord_sheet(chord_sheet):
16
  processed_lines = [process_line(line) for line in chord_sheet.split('\n')]
17
  return '<br>'.join(processed_lines)
18
 
19
- def create_search_url(base_url, artist_song):
20
- return base_url + artist_song.replace(' ', '+').replace('–', '%E2%80%93').replace('&', 'and')
21
-
22
- def load_song_file(file_path):
23
- with open(file_path, 'r', encoding='utf-8') as file:
24
- return file.read()
25
 
26
  def display_chord_sheet_in_two_page_view(chord_sheet):
 
 
 
27
  # HTML structure for two-page view
28
  html_content = f"""
29
  <div style="display: flex; justify-content: space-between;">
30
  <div style="width: 49%; overflow: scroll; white-space: pre-wrap; font-size: small;">
31
- {chord_sheet}
32
  </div>
33
  <div style="width: 49%; overflow: scroll; white-space: pre-wrap; font-size: small;">
34
- {chord_sheet}
35
  </div>
36
  </div>
37
  """
38
- components.html(html_content, height=600)
39
 
40
  def main():
41
  col1, col3 = st.columns([3, 5])
 
16
  processed_lines = [process_line(line) for line in chord_sheet.split('\n')]
17
  return '<br>'.join(processed_lines)
18
 
19
+ def split_text(text, split_ratio=0.5):
20
+ lines = text.split('\n')
21
+ split_point = int(len(lines) * split_ratio)
22
+ return '\n'.join(lines[:split_point]), '\n'.join(lines[split_point:])
 
 
23
 
24
  def display_chord_sheet_in_two_page_view(chord_sheet):
25
+ # Splitting the text into two halves
26
+ first_half, second_half = split_text(chord_sheet)
27
+
28
  # HTML structure for two-page view
29
  html_content = f"""
30
  <div style="display: flex; justify-content: space-between;">
31
  <div style="width: 49%; overflow: scroll; white-space: pre-wrap; font-size: small;">
32
+ {first_half}
33
  </div>
34
  <div style="width: 49%; overflow: scroll; white-space: pre-wrap; font-size: small;">
35
+ {second_half}
36
  </div>
37
  </div>
38
  """
39
+ components.html(html_content, height=1200) # Increased height
40
 
41
  def main():
42
  col1, col3 = st.columns([3, 5])