davanstrien HF staff commited on
Commit
2f1f9eb
1 Parent(s): bf43437

chore: Update app.py with improved styling and image display

Browse files
Files changed (2) hide show
  1. README.md +2 -2
  2. app.py +7 -6
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
- title: Loc Songs
3
- emoji: 🐠
4
  colorFrom: indigo
5
  colorTo: blue
6
  sdk: gradio
 
1
  ---
2
+ title: Library of Congress Song Sheet ColPali Explorer
3
+ emoji: 🎵
4
  colorFrom: indigo
5
  colorTo: blue
6
  sdk: gradio
app.py CHANGED
@@ -123,7 +123,7 @@ with gr.Blocks() as demo:
123
  gr.HTML(
124
  """
125
  <h1 style='text-align: center; color: #2a4b7c;'>America Singing: Nineteenth-Century Song Sheets ColPali Search</h1>
126
- <div style="display: flex; align-items: flex-start; margin-bottom: 20px;">
127
  <div style="flex: 2; padding-right: 20px;">
128
  <p>This app allows you to search through the Library of Congress's <a href="https://www.loc.gov/collections/nineteenth-century-song-sheets/about-this-collection/" target="_blank">"America Singing: Nineteenth-Century Song Sheets"</a> collection using natural language queries. The collection contains 4,291 song sheets from the 19th century, offering a unique window into American history, culture, and music.</p>
129
 
@@ -139,9 +139,11 @@ with gr.Blocks() as demo:
139
  </ul>
140
  </p>
141
  </div>
142
- <div style="flex: 1;">
143
- <img src="https://tile.loc.gov/image-services/iiif/service:rbc:amss:hc:00:00:3b:hc00003b:001a/full/pct:50/0/default.jpg" alt="Example Song Sheet" style="width: 100%; height: auto; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);">
144
- <p style="text-align: center;"><em>Example of a song sheet from the collection</em></p>
 
 
145
  </div>
146
  </div>
147
  """
@@ -151,7 +153,6 @@ with gr.Blocks() as demo:
151
  search_box = gr.Textbox(
152
  label="Search Query", placeholder="i.e. Irish migrant experience"
153
  )
154
- with gr.Column(scale=1):
155
  submit_button = gr.Button("Search", variant="primary")
156
  num_results = gr.Slider(
157
  minimum=1, maximum=20, step=1, label="Number of Results", value=5
@@ -159,7 +160,7 @@ with gr.Blocks() as demo:
159
  results_html = gr.HTML(label="Search Results")
160
 
161
  submit_button.click(
162
- fn=lambda query, top_k: search_and_display_wrapper(query, top_k, 100),
163
  inputs=[search_box, num_results],
164
  outputs=results_html,
165
  )
 
123
  gr.HTML(
124
  """
125
  <h1 style='text-align: center; color: #2a4b7c;'>America Singing: Nineteenth-Century Song Sheets ColPali Search</h1>
126
+ <div style="display: flex; align-items: stretch; margin-bottom: 20px;">
127
  <div style="flex: 2; padding-right: 20px;">
128
  <p>This app allows you to search through the Library of Congress's <a href="https://www.loc.gov/collections/nineteenth-century-song-sheets/about-this-collection/" target="_blank">"America Singing: Nineteenth-Century Song Sheets"</a> collection using natural language queries. The collection contains 4,291 song sheets from the 19th century, offering a unique window into American history, culture, and music.</p>
129
 
 
139
  </ul>
140
  </p>
141
  </div>
142
+ <div style="flex: 1; display: flex; flex-direction: column;">
143
+ <div style="flex-grow: 1; display: flex; flex-direction: column; justify-content: center;">
144
+ <img src="https://tile.loc.gov/image-services/iiif/service:rbc:amss:hc:00:00:3b:hc00003b:001a/full/pct:50/0/default.jpg" alt="Example Song Sheet" style="width: 100%; height: auto; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);">
145
+ </div>
146
+ <p style="text-align: center; margin-top: 10px;"><em>Example of a song sheet from the collection</em></p>
147
  </div>
148
  </div>
149
  """
 
153
  search_box = gr.Textbox(
154
  label="Search Query", placeholder="i.e. Irish migrant experience"
155
  )
 
156
  submit_button = gr.Button("Search", variant="primary")
157
  num_results = gr.Slider(
158
  minimum=1, maximum=20, step=1, label="Number of Results", value=5
 
160
  results_html = gr.HTML(label="Search Results")
161
 
162
  submit_button.click(
163
+ fn=lambda query, top_k: search_and_display_wrapper(query, top_k, 50),
164
  inputs=[search_box, num_results],
165
  outputs=results_html,
166
  )