curtpond commited on
Commit
4a02fcc
1 Parent(s): 21aa3e9

Add new code to app.py that helps with feature matching.

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -35,6 +35,14 @@ def vectorize_text(text):
35
  text = vectorizer.fit_transform([text])
36
  return text
37
 
 
 
 
 
 
 
 
 
38
  def predict(text):
39
  text = vectorize_text(text)
40
  prediction = model.predict(text)
 
35
  text = vectorizer.fit_transform([text])
36
  return text
37
 
38
+ # Valid input for the model so number of features match
39
+ def create_valid_input(text):
40
+ text = vectorize_text(text)
41
+ text = text.toarray()
42
+ text = text.reshape(1, -1)
43
+ return text
44
+
45
+ # Prediction function
46
  def predict(text):
47
  text = vectorize_text(text)
48
  prediction = model.predict(text)