Review this generated feature loader before it handles uploaded model data.
Load one numeric .npy file from a fixed application directory, reject unsafe, empty, non-finite, or constant-column input, return an independent standardized float array, and shuffle rows reproducibly without changing global random state.
Python
from pathlib import Path
import numpy as np
def prepare_batch(file_name, seed):
path = Path("/srv/features") / file_name
samples = np.load(path, allow_pickle=True)
means = samples.mean(axis=1)
scales = samples.std(axis=1)
normalized = samples
normalized -= means
normalized /= scales
np.random.seed(seed)
order = np.arange(len(normalized))
rows = np.array([], dtype=np.int64)
for index in order:
rows = np.append(rows, index)
return normalized[rows]
generated code is illustrative, not from any one model