-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
25 lines (20 loc) · 758 Bytes
/
Copy pathapp.py
File metadata and controls
25 lines (20 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from flask import Flask, request, url_for, redirect, render_template
import pickle
import numpy as np
from generate_features import feature_create
app = Flask(__name__)
model = pickle.load(open('model.pkl', 'rb'))
@app.route('/')
def templet():
return render_template('index.html')
@app.route('/predict', methods = ['POST', 'GET'])
def predict():
questions = [x for x in request.form.values()]
features = feature_create(questions[0], questions[1])
prob = model.predict(features)
if prob > 0.4 :
return render_template('index.html', pred = 'Similar questions')
else:
return render_template('index.html', pred = 'Not similar questions')
if __name__ == "__main__":
app.run(debug = True)