Spaces:
Sleeping
Sleeping
File size: 1,116 Bytes
eed1704 dc03785 eed1704 dc03785 9b5fe88 dc03785 eed1704 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
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.")
|