Spaces:
Runtime error
Runtime error
import pickle | |
import datasets | |
import os | |
import umap | |
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: | |
dataset = pickle.load(file) | |
print("Dataset loaded from cache.") | |
else: | |
# Load dataset using datasets.load_dataset() | |
ds = datasets.load_dataset("renumics/speech_commands_enriched", split="test") | |
print("Dataset loaded using datasets.load_dataset().") | |
df = ds.to_pandas() | |
# Save dataset to cache | |
with open(cache_file, "wb") as file: | |
pickle.dump(df, file) | |
print("Dataset saved to cache.") | |