Skip to content

Commit

Permalink
Fix the bug with issues code 8641. (#8880)
Browse files Browse the repository at this point in the history
  • Loading branch information
smallbenxiong authored Aug 7, 2024
1 parent 4cf0806 commit 6235fcd
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions legacy/examples/text_to_knowledge/nptag/deploy/python/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,15 @@ def predict(self, data, tokenizer):
break
else:
labels_can = bk_tree.search_similar_word(label)
result["label"] = labels_can[0][0]

result["category"] = name_dict[result["label"]]
if len(labels_can) != 0:
result["label"] = labels_can[0][0]
else:
result["label"] = None

if result["label"] in name_dict:
result["category"] = name_dict[result["label"]]
else:
result["category"] = None
results.append(result)
return results

Expand Down

0 comments on commit 6235fcd

Please sign in to comment.