Skip to content

Commit

Permalink
Fix overly long line
Browse files Browse the repository at this point in the history
  • Loading branch information
jamt9000 committed Jan 5, 2025
1 parent a669e06 commit 878bf90
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions detoxify/detoxify.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,11 @@ def predict(self, text):
results = {}
for i, cla in enumerate(self.class_names):
results[cla] = (
# If the input is a single text, squeezing will remove the dimensionality from the tensor - so `.tolist()` will return a number instead. Otherwise, we'll get the list of scores of that class.
scores[:,i].squeeze().tolist()
# If the input is a single text, squeezing will remove the dimensionality from the tensor -
# so `.tolist()` will return a number instead. Otherwise, we'll get the list of scores of that class.
scores[:, i]
.squeeze()
.tolist()
)
return results

Expand Down

0 comments on commit 878bf90

Please sign in to comment.