Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion vertexai/evaluation/notebook_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#
"""Python functions which run only within a Jupyter or Colab notebook."""

import html as html_lib
import random
import string
import sys
Expand Down Expand Up @@ -153,7 +154,9 @@ def display_explanations(

for _, row in df.iterrows():
for col in df.columns:
display(HTML(f"<div style='{style}'><h4>{col}:</h4>{row[col]}</div>"))
safe_col = html_lib.escape(str(col))
safe_val = html_lib.escape(str(row[col]))
display(HTML(f"<div style='{style}'><h4>{safe_col}:</h4>{safe_val}</div>"))
display(HTML("<hr>"))


Expand Down
5 changes: 4 additions & 1 deletion vertexai/preview/evaluation/notebook_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#
"""Python functions which run only within a Jupyter or Colab notebook."""

import html as html_lib
import random
import string
import sys
Expand Down Expand Up @@ -153,7 +154,9 @@ def display_explanations(

for _, row in df.iterrows():
for col in df.columns:
display(HTML(f"<div style='{style}'><h4>{col}:</h4>{row[col]}</div>"))
safe_col = html_lib.escape(str(col))
safe_val = html_lib.escape(str(row[col]))
display(HTML(f"<div style='{style}'><h4>{safe_col}:</h4>{safe_val}</div>"))
display(HTML("<hr>"))


Expand Down