-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflask_api.py
More file actions
44 lines (29 loc) · 992 Bytes
/
flask_api.py
File metadata and controls
44 lines (29 loc) · 992 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# -*- coding: utf-8 -*-
"""
Created on Fri May 15 12:50:04 2020
@author: krish.naik
"""
from flask import Flask, request
import pickle
import pandas as pd
import numpy as np
app = Flask(__name__)
pickle_in = open("classifier1.pkl","rb")
classifier=pickle.load(pickle_in)
def welcome():
return "Welcome All"
@app.route('/predict')
def predict_note_authentication():
variance=request.args.get('variance')
skewness=request.args.get('skewness')
curtosis=request.args.get('curtosis')
entropy=request.args.get('entropy')
prediction=classifier.predict([[variance,skewness,curtosis,entropy]])
return "Hello The answer is"+str(prediction)
@app.route('/predict_file', methods = ["POST"])
def predict_note_file():
df_test = pd.read_csv(request.files.get("file"))
prediction = classifier.predict(df_test)
return "The prdicted values are"+str(list(prediction))
if __name__=='__main__':
app.run()