-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
35 lines (29 loc) · 952 Bytes
/
app.py
File metadata and controls
35 lines (29 loc) · 952 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
from flask import Flask, request, jsonify
import pickle
# not able to import
# from Werkzeug import secure_filename
app = Flask(__name__)
# model = pickle.load(open('model/model.pkl','rb'))
@app.route("/")
def hello_world():
return "Server to deploy our model <3"
@app.route('/api/predict',methods=['POST'])
def predict():
# data = request.get_json(force=True)
# prediction = model.predict([[np.array(data['exp'])]])
# output = prediction[0]
# return jsonify(output)
f = request.files['music']
f.save(f.filename)
return 'file uploaded successfully'
@app.route('/api/upload')
def upload_file():
return render_template('upload.html')
@app.route('/api/uploader', methods = ['GET', 'POST'])
def upload_music():
if request.method == 'POST':
f = request.files['music']
f.save(f.filename)
return 'file uploaded successfully'
if __name__ == '__main__':
app.run(port=5000, debug=True)