MarkusStoll's picture
only show embeddings
b7b88e8
raw
history blame
926 Bytes
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:
df = df.drop(columns=["embedding_ft", "nn_image"])
dtypes = {
"image": spotlight.Image,
"embedding_foundation": spotlight.Embedding,
"embedding_foundation_precalc": spotlight.Embedding,
}
view = spotlight.show(
df,
dtype=dtypes,
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.")