Spaces:
Runtime error
Runtime error
import pickle | |
from renumics import spotlight | |
from renumics.spotlight import layout | |
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 = { | |
"full_audio": spotlight.Audio, | |
"embedding_reduced": spotlight.Embedding | |
} | |
view = spotlight.show( | |
df, | |
dtype=dtypes, | |
layout= layout.parse("spotlight-layout.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.") | |