this is my python code use to predict the NLP model
model = load_model('model.h5')
intents = json.loads(open('data.json').read())
words = pickle.load(open('texts.pkl','rb'))
classes = pickle.load(open('labels.pkl','rb'))
app= Flask(__name__)
@app.route('/')
def home():
return render_template('home.html')
@app.route('/response', methods=['POST'])
def response():
intents = request.form['ints']
res = [intents]
prediction = model.predict(res)
output = prediction
return render_template('result.html', prediction_text=output)
and this is my HTML code
<form action="" method="POST">
<label for="mark"></label>
<textarea name="ints" rows="4" cols="50"></textarea>
<input type="submit" name="response" value="Response">
</form>
This is my result.html
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h2></h2>
<h2></h2>
</body>
</html>
i had tried a lot so solution, but it still cannot predict the result using my model, can someone help me solve this error. thanks.. appreciate... i just need to know how to pass the attribute between flask and HTML so that i can view my predict result inside HTML...
Aucun commentaire:
Enregistrer un commentaire