title: AttributeError: 'int' object has no attribute 'lower'
body: <p>I am trying to pass a tweet from a flask UI and be able to make a prediction of the type of the tweet if its a donation, disaster etc.</p>
  
  <p>Here is a working code from Jupyter notebook:</p>
  
  <pre><code>loaded_model = joblib.load('NB_spam_model.pkl')
  result = loaded_model.score(X_test, y_test)
  predict = loaded_model.predict([new_tweet])
  print(result)
  print(predict)
  </code></pre>
  
  <p>The results </p>
  
  <pre><code>0.8409090909090909
  ['donations_and_help']
  </code></pre>
  
  <p>May someone help me look at the code and correct me where i am doing it wrong?</p>
  
  <pre><code>app = Flask(__name__)
  
  @app.route('/')
  def index():
      return render_template("index.html" )
  
  @app.route("/predict", methods=["GET","POST"])
  def api():
  
  
  
  if request.method == "POST":
          words = joblib.load('words.pkl')
          model = joblib.load('NB_spam_model.pkl')
          pstem = PorterStemmer()
  
          tweet = request.form["tweet"]
          text = tweet
          text = re.sub("[^a-zA-Z]", ' ', text)   
          text = text.lower()
          text = text.split()
          text = [pstem.stem(word) for word in text if not word in set(stopwords.words('english'))]
          text = ' '.join(text)
          print("This is the text %s:" + text)
  
          query = []
          for word in words:
              if word in text:
                  query.append(1)
              else:
                  query.append(0)
  
          print(query)
          #prediction = list(model.predict(np.matrix(query)))[0]
          pred = model.predict(query)[0]
  
          print(pred)
  
          if pred == 1:
              msg = "."
              return render_template("index.html", msg=msg, tweet=tweet)
          else:
              error = "Approximately 70%, your tweet Fake"
              return render_template("index.html", error=error, tweet=tweet)
      else:
          return redirect(url_for("index"))
  
  if __name__ == '__main__':
      app.run(debug=False)
  </code></pre>
  
  <p>Stack trace:</p>
  
  <pre><code>Project\lib\site-packages\sklearn\feature_extraction\text.py", 
     line 69, in _preprocess
     doc = doc.lower()
  AttributeError: 'int' object has no attribute 'lower'
  127.0.0.1 - - [03/Jun/2020 20:17:47] "?[35m?[1mPOST /predict HTTP/1.1?[0m" 500 -
  </code></pre>