I have a image generator which samples a few fairly large datasets (around 10K words per category).

The user selects a dataset , from which a word is randomly selected.

As such , I only need to load the dataset which is currently selected.

I’d like for the other datasets to be un-loaded until the user selects them.

Is there a way to do this?

Or , can this problem be resolved by other means?