-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathFlask_App.py
33 lines (23 loc) · 925 Bytes
/
Flask_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
# This file is a raw flask implementation test it using Postman
from flask import Flask, render_template, redirect, request
import numpy as np
import pandas as pd
import pickle
app = Flask(__name__)
pickle_in = open('classifier.pkl', 'rb')
classifier = pickle.load(pickle_in)
@app.route("/")
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 "The predicted values is " + str(prediction)
@app.route("/predict_file", methods=["POST"])
def predict_file():
df_test = pd.read_csv(request.files.get('file'))
prediction = classifier.predict(df_test)
return "The predicted values for the csv is " + str(list(prediction))
if __name__ == '__main__':
app.run()