lvwerra HF staff commited on
Commit
96d3a8b
·
1 Parent(s): 1234e1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -12,7 +12,7 @@ import requests
12
  def mark_tokens_bold(string, tokens):
13
  for token in tokens:
14
  pattern = r"\b" + re.escape(token) + r"\b"
15
- string = re.sub(pattern, "<b>" + token + "</b>", string)
16
  return string
17
 
18
 
@@ -37,7 +37,7 @@ def process_results(results, highlight_terms):
37
  docid_html = str(result["docid"])
38
  results_html += """{}
39
  <p style='font-size:14px; font-family: Arial; color:#7978FF; text-align: left;'>Document ID: {}</p>
40
- <pre><code>{}</code></pre>
41
  <br>
42
  """.format(
43
  meta_html, docid_html, text_html
 
12
  def mark_tokens_bold(string, tokens):
13
  for token in tokens:
14
  pattern = r"\b" + re.escape(token) + r"\b"
15
+ string = re.sub(pattern, "<span style='color: red;'><b>" + token + "</b></span>", string)
16
  return string
17
 
18
 
 
37
  docid_html = str(result["docid"])
38
  results_html += """{}
39
  <p style='font-size:14px; font-family: Arial; color:#7978FF; text-align: left;'>Document ID: {}</p>
40
+ <pre style='height: 200px; overflow: scroll;'><code>{}</code></pre>
41
  <br>
42
  """.format(
43
  meta_html, docid_html, text_html