File size: 529 Bytes
da65d9f |
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 |
from flask import Flask, request, redirect, url_for, flash, jsonify
import numpy as np
import pickle as p
import json
app = Flask(__name__)
@app.route("/")
def home():
return "<h1>Lyrics Classifier</h1>"
@app.route('/api/', methods=['POST'])
def makecalc():
data = request.get_json()
prediction = np.array2string(model.predict(data))
return jsonify(prediction)
if __name__ == '__main__':
modelfile = '2179-proj.pickle'
model = p.load(open(modelfile, 'rb'))
app.run(debug=True, host='0.0.0.0')
|