Use Classifier for --category
This commit is contained in:
parent
b3a43150d8
commit
548d670960
|
@ -74,14 +74,12 @@ def main() -> None:
|
||||||
else:
|
else:
|
||||||
text = sys.stdin.read()
|
text = sys.stdin.read()
|
||||||
|
|
||||||
probabilities = model.confidence(text, args.max_ngram_length)
|
|
||||||
|
|
||||||
if args.category:
|
if args.category:
|
||||||
try:
|
classifier = gptc.Classifier(model, args.max_ngram_length)
|
||||||
print(sorted(probabilities.items(), key=lambda x: x[1])[-1][0])
|
print(classifier.classify(text))
|
||||||
except IndexError:
|
|
||||||
print(None)
|
|
||||||
else:
|
else:
|
||||||
|
probabilities = model.confidence(text, args.max_ngram_length)
|
||||||
print(json.dumps(probabilities))
|
print(json.dumps(probabilities))
|
||||||
else:
|
else:
|
||||||
print(json.dumps(gptc.pack(args.model, True)[0]))
|
print(json.dumps(gptc.pack(args.model, True)[0]))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user