Fix: Define missing `input_text` variable to enable result formatting in example code
#11
by
anon-repair-bot
- opened
Description
The example code triggers the following NameError at runtime:
print(pd.DataFrame(results, index=input_text).round(5))
# NameError: name 'input_text' is not defined
Changes
Replaced:
results = Detoxify('multilingual').predict(['example text', 'exemple de texte', ...])
print(pd.DataFrame(results, index=input_text).round(5))
with:
input_text = ['example text', 'exemple de texte', 'texto de ejemplo',
'testo di esempio', 'texto de exemplo', 'örnek metin', 'пример текста']
results = Detoxify('multilingual').predict(input_text)
print(pd.DataFrame(results, index=input_text).round(5))
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.