yassine-thlija commited on
Commit
4199800
·
1 Parent(s): 1f67299

debug html, back to old

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +2 -8
src/streamlit_app.py CHANGED
@@ -7,7 +7,6 @@ from huggingface_hub import snapshot_download
7
  import colorsys
8
  import html
9
  import os
10
- import re
11
  import streamlit.components.v1 as components
12
 
13
  # text utils
@@ -69,10 +68,6 @@ def sanity_check(df_ann, text_len):
69
  return df_ann["global_end"].max() <= text_len
70
 
71
 
72
- def html_attr(value):
73
- return html.escape(str(value), quote=True).replace("\n", "&#10;")
74
-
75
-
76
  def get_hf_dataset_root():
77
  repo = os.getenv("HF_DATASET_REPO")
78
  if not repo:
@@ -522,7 +517,7 @@ def render_highlighted_html(
522
  f"{m['label']} — {m['annotator']} ({m['curation']})"
523
  )
524
 
525
- title_attr = html_attr("\n".join(tooltip_lines))
526
 
527
  is_focus = focus_ann_id in ann_ids if focus_ann_id else False
528
  focus_box = False
@@ -530,8 +525,7 @@ def render_highlighted_html(
530
  focus_box = max(s, focus_range[0]) < min(e, focus_range[1])
531
  anchor_attr = ""
532
  if is_focus and not anchored:
533
- safe_id = re.sub(r"[^a-zA-Z0-9_-]", "_", str(focus_ann_id))
534
- anchor_attr = f' id="ann-{safe_id}"'
535
  anchored = True
536
 
537
  focus_style = (
 
7
  import colorsys
8
  import html
9
  import os
 
10
  import streamlit.components.v1 as components
11
 
12
  # text utils
 
68
  return df_ann["global_end"].max() <= text_len
69
 
70
 
 
 
 
 
71
  def get_hf_dataset_root():
72
  repo = os.getenv("HF_DATASET_REPO")
73
  if not repo:
 
517
  f"{m['label']} — {m['annotator']} ({m['curation']})"
518
  )
519
 
520
+ title_attr = html.escape("\n".join(tooltip_lines))
521
 
522
  is_focus = focus_ann_id in ann_ids if focus_ann_id else False
523
  focus_box = False
 
525
  focus_box = max(s, focus_range[0]) < min(e, focus_range[1])
526
  anchor_attr = ""
527
  if is_focus and not anchored:
528
+ anchor_attr = f' id="ann-{focus_ann_id}"'
 
529
  anchored = True
530
 
531
  focus_style = (