Last active
June 19, 2019 02:27
-
-
Save wfng92/7329eab023dac6c7b1640c429210ac72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from . import run_classifier | |
import os | |
import tensorflow as tf | |
import json | |
def getListPrediction(in_sentences): | |
#1 | |
input_examples = [run_classifier.InputExample(guid="", text_a = x, text_b = None, label = "0") for x in in_sentences] # here, "" is just a dummy label | |
#2 | |
input_features = run_classifier.convert_examples_to_features(input_examples, label_list, MAX_SEQ_LENGTH, tokenizer) | |
#3 | |
predict_input_fn = run_classifier.input_fn_builder(features=input_features, seq_length=MAX_SEQ_LENGTH, is_training=False, drop_remainder=False) | |
#4 | |
predictions = estimator.predict(input_fn=predict_input_fn) | |
return predictions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment