You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.
import sys
import pytext
config_file = sys.argv[1]
model_file = sys.argv[2]
config = pytext.load_config(config_file)
predictor = pytext.create_predictor(config, model_file)
if __name__ == "__main__":
while True:
text = input()
# Pass the inputs to PyText's prediction API
result = predictor({"text": text})
# Results is a list of output blob names and their scores.
# The blob names are different for joint models vs doc models
# Since this tutorial is for both, let's check which one we should look at.
doc_label_scores_prefix = (
'scores:' if any(r.startswith('scores:') for r in result)
else 'doc_scores:'
)
# For now let's just output the top document label!
best_doc_label = max(
(label for label in result if label.startswith(doc_label_scores_prefix)),
key=lambda label: result[label][0],
# Strip the doc label prefix here
)[len(doc_label_scores_prefix):]
print(best_doc_label)
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Steps to reproduce
python test_predict.py demo/configs/docnn.json /tmp/model.caffe2.predictor
hotel service too bad
Observed Results
neg
zsh: segmentation fault python test_predict.py demo/configs/docnn.json /tmp/model.caffe2.predictor
Expected Results
neg
Relevant Code
test_predict.py
The text was updated successfully, but these errors were encountered: