from flask import Flask, render_template, request, jsonify | |
import model # Import your model module | |
app = Flask(__name__) | |
def home(): | |
if request.method == 'POST': | |
data = request.json | |
user_input = data['text'] | |
# Use your model to classify the text | |
prediction = model.predict(user_input) | |
return jsonify({'classification': prediction}) | |
return render_template('home.html') | |
if __name__ == '__main__': | |
app.run() | |