Sort predictions in Inference API?

Hi :hugs: team!

If I have a text classifier uploaded to the Hub, is there a way to sort the predictions so that the classes with highest confidence are shown first?

The GIF below is from this model and with 150 classes one currently has to scroll down to find the most probable class (car_rental in this case):

ezgif.com-gif-maker

Thanks!

1 Like

Thanks for suggesting! I think this is already on the roadmap for soon-ish :slight_smile:

1 Like

we’ve been discussing this internally but it’s hard to know whether we actually want to do this because for some models you probably want the labels in their defined order (say a model trained on amazon_reviews)

And exposing this as an option adds… well, another option.

Happy to hear others’ thoughts on this though!

Perhaps a sort of dropdown in the UI where you simply sort on the front-end and give the user all the control? (With a cookie so that they do not have to change their preference every call to the API.) Options can be alphabetically, highest/lowest predictions, defined order…

1 Like

+1 on a dropdown / button to sort with!

ps. my use case with 150 classes might be an exception to the rule, so it might be overkill to add a new option just for me :slight_smile: