How to use a text classifier in production fast.ai v2

OK so I think the problem was that
names = [learner.dls.vocab[p] for p in preds_class] should be
names = [learner.dls.vocab[1][p] for p in preds_class]

learner.dls.vocab[1] is a category map with the categories in it.

Thanks for the help.

2 Likes