Carlos Rosas commited on
Commit
bd4216b
Β·
verified Β·
1 Parent(s): 95aae57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -8
app.py CHANGED
@@ -32,7 +32,7 @@ tokenizer.pad_token = tokenizer.eos_token
32
  tokenizer.pad_token_id = 1
33
 
34
  # Define variables
35
- temperature = 0.25
36
  max_new_tokens = 1200
37
  top_p = 0.95
38
  repetition_penalty = 1.0
@@ -129,8 +129,10 @@ def format_references(text):
129
  ref_number = 1
130
 
131
  import re
132
- # Remove leading dots from lines
133
- text = re.sub(r'^\s*\.\s*', '', text, flags=re.MULTILINE)
 
 
134
 
135
  for match in re.finditer(ref_pattern, text):
136
  # Add text before the reference
@@ -141,7 +143,7 @@ def format_references(text):
141
  ref_id = match.group(1)
142
  ref_text = match.group(2).strip()
143
 
144
- # Add the reference with period and line break
145
  tooltip_html = f'<span class="tooltip"><strong>[{ref_number}]</strong><span class="tooltiptext"><strong>{ref_id}</strong>: {ref_text}</span></span>.<br>'
146
  parts.append(tooltip_html)
147
 
@@ -173,7 +175,7 @@ css = """
173
  .tooltip {
174
  position: relative;
175
  display: inline-block;
176
- color: #007FFF;
177
  font-weight: bold;
178
  cursor: pointer;
179
  }
@@ -232,9 +234,14 @@ with demo:
232
  <div style="display: flex; justify-content: center; width: 100%; background-color: black; padding: 5px 0;">
233
  <pre style="font-family: monospace; line-height: 1.2; font-size: 24px; color: #00ffea; margin: 0;">
234
 
235
- ╔═══════════════════╗
236
- β•‘ pleias-RAG 1.0 β•‘
237
- β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
 
 
 
 
 
238
  </pre>
239
  </div>
240
  """)
 
32
  tokenizer.pad_token_id = 1
33
 
34
  # Define variables
35
+ temperature = 0.0
36
  max_new_tokens = 1200
37
  top_p = 0.95
38
  repetition_penalty = 1.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
 
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
  .tooltip {
176
  position: relative;
177
  display: inline-block;
178
+ color: #0000FF;
179
  font-weight: bold;
180
  cursor: pointer;
181
  }
 
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
+ | | (_) | ___ \/ _ \| __ \
239
+ _ __ | | ___ _ __ _ ___ ______ | |_/ / /_\ \ | \/
240
+ | '_ \| |/ _ \ |/ _` / __| |______| | /| _ | | __
241
+ | |_) | | __/ | (_| \__ \ | |\ \| | | | |_\ \
242
+ | .__/|_|\___|_|\__,_|___/ \_| \_\_| |_/\____/
243
+ | |
244
+ |_|
245
  </pre>
246
  </div>
247
  """)