def file_to_hub(file_name, sample_out, class_names):
## First two arguments are always default arguments containing:
# 1st argument is an element of the input iterable (list, dataset, array,...)
# 2nd argument is a dataset sample
# Other arguments are optional
# Find the label number corresponding to the file
label_text = os.path.basename(os.path.dirname(file_name))
label_num = class_names.index(label_text)
# Append the label and image to the output sample
sample_out.labels.append(np.uint32(label_num))
sample_out.images.append(hub.read(file_name))