-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclientApp.py
More file actions
31 lines (23 loc) · 724 Bytes
/
clientApp.py
File metadata and controls
31 lines (23 loc) · 724 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
from flask import Flask, request, jsonify,render_template
import os
from flask_cors import CORS, cross_origin
from kerasa.predict2 import predict
from my_utilities.decode import decodeSound
os.putenv('LANG', 'en_US.UTF-8')
os.putenv('LC_ALL', 'en_US.UTF-8')
app = Flask(__name__)
CORS(app)
@app.route("/", methods=['GET'])
@cross_origin()
def home():
return render_template('index.html')
@app.route("/predict", methods=['POST'])
@cross_origin()
def predictRoute():
image = request.json['sound']
decodeSound(image, "inputSound.wav")
result = predict()
return jsonify({"Result": result})
# port = int(os.getenv("PORT"))
if __name__ == "__main__":
app.run(host='0.0.0.0', port=5000, debug=True)