Skip to content

Commit

Permalink
fix show report in JupyterLab (#710)
Browse files Browse the repository at this point in the history
  • Loading branch information
pplonski committed Mar 4, 2024
1 parent db8fade commit 47abab9
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions supervised/base_automl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2393,25 +2393,22 @@ def _md_to_html(self, md_fname, page_type, dir_path, me=None):
for f in os.listdir(dir_path):
if os.path.exists(os.path.join(dir_path, f, "README.md")):
old = f'href="{f}/README.html"'
new = f"onclick=\"toggleShow('{f}');toggleShow('main')\" "
new = f"onclick=\"toggleShow('{f}');toggleShow('automl-report-main')\" "
content_html = content_html.replace(old, new)

# other links
if me is not None:
old = 'href="../README.html"'
new = f"onclick=\"toggleShow('{me}');toggleShow('main')\" "
new = f"onclick=\"toggleShow('{me}');toggleShow('automl-report-main')\" "
content_html = content_html.replace(old, new)

beginning = ""

if page_type == "main":
beginning += """<img src="https://raw.githubusercontent.com/mljar/visual-identity/main/media/mljar_AutomatedML.png" style="height:128px; margin-left: auto;
margin-right: auto;display: block;"/>\n\n"""
# disable EDA
# if os.path.exists(os.path.join(self._results_path, "EDA")):
# beginning += "<a onclick=\"toggleShow('EDA');toggleShow('main')\" >Automatic Exploratory Data Analysis Report</a>"
if os.path.exists(os.path.join(self._results_path, "optuna/README.md")):
beginning += "<h2><a onclick=\"toggleShow('optuna');toggleShow('main')\" >&#187; Optuna Params Tuning Report</a></h2>"
beginning += "<h2><a onclick=\"toggleShow('optuna');toggleShow('automl-report-main')\" >&#187; Optuna Params Tuning Report</a></h2>"

content_html = beginning + content_html

Expand All @@ -2436,8 +2433,8 @@ def _report(self, width=900, height=1200):
body = ""
fname = os.path.join(self._results_path, "README.md")
body += (
'<div id="main">\n'
+ self._md_to_html(fname, "main", self._results_path)
'<div id="automl-report-main">\n'
+ self._md_to_html(fname, "automl-report-main", self._results_path)
+ "\n\n</div>\n\n"
)

Expand Down

0 comments on commit 47abab9

Please sign in to comment.