from flask import Flask, request, render_template import pickle # Load the model from the pickle file with open('gs_clf.pickle', 'rb') as f: spam_classifier = pickle.load(f) # Load the spam classifier app = Flask(__name__) @app.route('/', methods=['GET', 'POST']) def classify_message(): if request.method == 'POST': message = request.form['message'] print(message) prediction = spam_classifier.predict([message]) print(prediction) return render_template('index.html', prediction=prediction[0]) return render_template('index.html', prediction=None) if __name__ == '__main__': app.run(host='0.0.0.0', port=5000)