Anon
commited on
Commit
·
3fbdd2b
1
Parent(s):
00d17a9
update viewer.
Browse files- src/streamlit_app.py +12 -4
src/streamlit_app.py
CHANGED
|
@@ -5,6 +5,7 @@ import numpy as np
|
|
| 5 |
|
| 6 |
import pandas as pd
|
| 7 |
import streamlit as st
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
def parse_filename(fname: str):
|
|
@@ -104,9 +105,16 @@ else:
|
|
| 104 |
items = filtered.to_dict(orient="records")
|
| 105 |
for item in items:
|
| 106 |
caption = f"{item['sparsity']} out of {item['sparsity_out_of']}"
|
| 107 |
-
|
| 108 |
-
|
| 109 |
gif_bytes = Path(item["path"]).read_bytes()
|
| 110 |
-
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
st.divider()
|
|
|
|
| 5 |
|
| 6 |
import pandas as pd
|
| 7 |
import streamlit as st
|
| 8 |
+
import base64
|
| 9 |
|
| 10 |
|
| 11 |
def parse_filename(fname: str):
|
|
|
|
| 105 |
items = filtered.to_dict(orient="records")
|
| 106 |
for item in items:
|
| 107 |
caption = f"{item['sparsity']} out of {item['sparsity_out_of']}"
|
|
|
|
|
|
|
| 108 |
gif_bytes = Path(item["path"]).read_bytes()
|
| 109 |
+
b64 = base64.b64encode(gif_bytes).decode("ascii")
|
| 110 |
+
|
| 111 |
+
st.markdown(
|
| 112 |
+
f"""
|
| 113 |
+
<figure style="margin:0;">
|
| 114 |
+
<img src="data:image/gif;base64,{b64}" style="max-width:100%; height:auto;" />
|
| 115 |
+
<figcaption style="font-size:0.9em; color: #666;">{caption}</figcaption>
|
| 116 |
+
</figure>
|
| 117 |
+
""",
|
| 118 |
+
unsafe_allow_html=True,
|
| 119 |
+
)
|
| 120 |
st.divider()
|