-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
28 lines (21 loc) · 823 Bytes
/
Copy pathapp.py
File metadata and controls
28 lines (21 loc) · 823 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
import logging
from flask import Flask, request, jsonify
import pickle
import numpy as np
model = pickle.load(open('modelAcousticExpEns.pkl', 'rb'))
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def home():
return 'Quote: Equipped with his five senses, man explores the universe around him and calls the adventure Science. –- Edwin Hubble'
@app.route('/predict', methods=['POST'])
def predict():
amp = request.form.get('amp',type=float)
phase = request.form.get('phase',type=float)
# amp=0.00;
# phase = 0.00;
expression = {'amp': amp, 'phase': phase}
input_query = np.array([[amp, phase]])
expression = model.predict(input_query)[0]
return jsonify({'expression:': expression})
if __name__ == '__main__':
app.run(debug=True)