MarkusStoll's picture
readme updated layout ref
9b5fe88
import pickle
from renumics import spotlight
import os
if __name__ == "__main__":
cache_file = "dataset_cache.pkl"
if os.path.exists(cache_file):
# Load dataset from cache
with open(cache_file, "rb") as file:
df = pickle.load(file)
print("Dataset loaded from cache.")
while True:
dtypes = {
"nn_image": spotlight.Image,
"image": spotlight.Image,
"embedding_ft": spotlight.Embedding,
"embedding_foundation": spotlight.Embedding,
"embedding_ft_precalc": spotlight.Embedding,
"embedding_foundation_precalc": spotlight.Embedding,
}
view = spotlight.show(
df,
dtype=dtypes,
layout="https://spotlight.renumics.com/resources/layout_pre_post_ft_hf.json",
port=7860,
host="0.0.0.0",
allow_filebrowsing=False
)
view.close()
else:
print(f"Dataset {cache_file} not found. Please run prepare.py first.")