Fix: Define missing `input_text` variable to enable result formatting in example code

#11

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.

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

Sign up or log in to comment