Fix: Correct prediction printing logic in example code

#7

Description

This PR fixes runtime errors in the example code of the model card.
The following line triggered an exception at runtime:

TypeError: int() argument must be a string, a bytes-like object or a real number, not 'list'

Changes

Replaced:

[print("%7s" % int(prediction), end="") for prediction in predictions.tolist()]

with:

[print("%7s" % int(pred), end="") for pred in predictions[0]]

Testing

The code has been successfully tested and runs without error.

Note

This contribution is part of an ongoing research initiative to systematically identify and correct faulty example code in Hugging Face Model Cards.
We would appreciate a timely review and integration of this patch to support code reliability and enhance reproducibility for downstream users.

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment