Skip to content

Instantly share code, notes, and snippets.

@pemagrg1
Created September 4, 2019 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pemagrg1/974fa10137212022321b6b79a22316a7 to your computer and use it in GitHub Desktop.
Save pemagrg1/974fa10137212022321b6b79a22316a7 to your computer and use it in GitHub Desktop.
import pickle
Project_path = "<path to project>"
model_path = Project_path + "/08. Multi-class_text_classification/models/model.pickle"
vectorizer_path = Project_path + "/08. Multi-class_text_classification/models/vectorizer.pickle"
vectorizer = pickle.load(open(vectorizer_path,'rb'))
model = pickle.load(open(model_path,'rb'))
pred = model.predict(vectorizer.transform(["i have got a new phone. its from Apple.. and i love it!"]))[0]
print ("predicted class:", pred)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment