-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
41 lines (27 loc) · 870 Bytes
/
app.py
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 26 11:45:03 2021
@author: noopa
"""
import numpy as np
import pickle
import pandas as pd
from flask import Flask, request
from flask import Flask, request, jsonify, render_template
app=Flask(__name__)
pickle_in = open("classifier1.pkl","rb")
classifier=pickle.load(pickle_in)
@app.route('/')
def home():
return render_template('index.html')
@app.route('/predict',methods=['POST'])
def predict():
'''
For rendering results on HTML GUI
'''
int_features = [x for x in request.form.values()]
final_features = [np.array(int_features)]
prediction = classifier.predict(final_features)
return render_template('index.html', prediction_text='The flower belong to species {}'.format(prediction))
if __name__=='__main__':
app.run()