Fix: Correct prediction printing logic in example code
#7
by
anon-repair-bot
- opened
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.