Hi, all. I'm using songbird through the Artifact API and I have a question that I think applies broadly to Visualizations.
What I would like to do is retrieve the html itself from a Visualization in Python (i.e. the contents of data/index.html). As an example, songbird paired_summary returns a visualization that I can check in a notebook
For my purposes, I am primarily interested in extracting the Q^2 score. My current solution is something like this:
tmp_file = "tmp.qzv"
paired_summary_results.visualization.save(tmp_file)
tmp_viz = Visualization.load(tmp_file)
uuid = str(viz.uuid)
html_file = f"{uuid}/data/index.html"
import zipfile
with zipfile.ZipFile(tmp_file) as myzip:
with myzip.open(html_file) as myfile:
text = myfile.read()
q2 = parse_html_for_q2(text)
os.remove(tmp_file)
Ideally, I would like to do this without the use of any temporary files that I save to disk. Is this something I can easily do?
