Carlos Rosas commited on
Commit
3a275e3
·
verified ·
1 Parent(s): bd4216b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -128,12 +128,6 @@ def format_references(text):
128
  current_pos = 0
129
  ref_number = 1
130
 
131
- import re
132
- # Remove leading dots and whitespace from lines
133
- lines = text.split('\n')
134
- cleaned_lines = [line.lstrip('. ').rstrip() for line in lines]
135
- text = '\n'.join(cleaned_lines)
136
-
137
  for match in re.finditer(ref_pattern, text):
138
  # Add text before the reference
139
  text_before = text[current_pos:match.start()].rstrip()
@@ -143,7 +137,7 @@ def format_references(text):
143
  ref_id = match.group(1)
144
  ref_text = match.group(2).strip()
145
 
146
- # Add the reference with period and line break
147
  tooltip_html = f'<span class="tooltip"><strong>[{ref_number}]</strong><span class="tooltiptext"><strong>{ref_id}</strong>: {ref_text}</span></span>.<br>'
148
  parts.append(tooltip_html)
149
 
@@ -175,7 +169,7 @@ css = """
175
  .tooltip {
176
  position: relative;
177
  display: inline-block;
178
- color: #0000FF;
179
  font-weight: bold;
180
  cursor: pointer;
181
  }
@@ -232,7 +226,7 @@ with demo:
232
  # Header with black bar
233
  gr.HTML("""
234
  <div style="display: flex; justify-content: center; width: 100%; background-color: black; padding: 5px 0;">
235
- <pre style="font-family: monospace; line-height: 1.2; font-size: 24px; color: #00ffea; margin: 0;">
236
 
237
  _ _ ______ ___ _____
238
  | | (_) | ___ \/ _ \| __ \
 
128
  current_pos = 0
129
  ref_number = 1
130
 
 
 
 
 
 
 
131
  for match in re.finditer(ref_pattern, text):
132
  # Add text before the reference
133
  text_before = text[current_pos:match.start()].rstrip()
 
137
  ref_id = match.group(1)
138
  ref_text = match.group(2).strip()
139
 
140
+ # Add the reference, keeping the existing period before the line break
141
  tooltip_html = f'<span class="tooltip"><strong>[{ref_number}]</strong><span class="tooltiptext"><strong>{ref_id}</strong>: {ref_text}</span></span>.<br>'
142
  parts.append(tooltip_html)
143
 
 
169
  .tooltip {
170
  position: relative;
171
  display: inline-block;
172
+ color: #183EFA;
173
  font-weight: bold;
174
  cursor: pointer;
175
  }
 
226
  # Header with black bar
227
  gr.HTML("""
228
  <div style="display: flex; justify-content: center; width: 100%; background-color: black; padding: 5px 0;">
229
+ <pre style="font-family: monospace; line-height: 1.2; font-size: 12px; color: #00ffea; margin: 0;">
230
 
231
  _ _ ______ ___ _____
232
  | | (_) | ___ \/ _ \| __ \