Nanny7 commited on
Commit
c79df26
·
1 Parent(s): f26e9e8

Use chemiscope.org viewer for artifacts

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -319,18 +319,16 @@ def _build_chemiscope_embed(dataset_payload: dict, dataset_path: str | Path) ->
319
  viewer_path = dataset_file.parent / viewer_name
320
  viewer_path.write_text(combined, encoding="utf-8")
321
 
322
- view_rel_path = f"/file={urllib.parse.quote(viewer_path.as_posix())}"
323
- space_origin = _infer_space_origin()
324
- iframe_src = f"{space_origin}{view_rel_path}" if space_origin else view_rel_path
325
  return (
326
  "<div style='width:100%;'>"
327
  "<iframe "
328
  "title='Chemiscope explorer' "
329
  "style='width:100%;height:620px;border:none;border-radius:8px;' "
330
- f"src='{iframe_src}'></iframe>"
331
  "<p style='font-size:0.9em;margin-top:0.5rem;'>"
332
  "Open in a new tab if the viewer looks blank: "
333
- f"<a href='{iframe_src}' target='_blank' rel='noopener'>Chemiscope standalone</a>"
334
  "</p>"
335
  "</div>"
336
  )
 
319
  viewer_path = dataset_file.parent / viewer_name
320
  viewer_path.write_text(combined, encoding="utf-8")
321
 
322
+ view_rel_path = viewer_path.as_posix()
 
 
323
  return (
324
  "<div style='width:100%;'>"
325
  "<iframe "
326
  "title='Chemiscope explorer' "
327
  "style='width:100%;height:620px;border:none;border-radius:8px;' "
328
+ f"src='https://chemiscope.org/?load={urllib.parse.quote(view_rel_path)}'></iframe>"
329
  "<p style='font-size:0.9em;margin-top:0.5rem;'>"
330
  "Open in a new tab if the viewer looks blank: "
331
+ f"<a href='https://chemiscope.org/?load={urllib.parse.quote(view_rel_path)}' target='_blank' rel='noopener'>Chemiscope standalone</a>"
332
  "</p>"
333
  "</div>"
334
  )