yukseltron
commited on
Commit
•
da65d9f
1
Parent(s):
52bcb5d
adjust index
Browse files- index.py +25 -0
- vercel.json +1 -1
index.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask import Flask, request, redirect, url_for, flash, jsonify
|
2 |
+
import numpy as np
|
3 |
+
import pickle as p
|
4 |
+
import json
|
5 |
+
|
6 |
+
|
7 |
+
app = Flask(__name__)
|
8 |
+
|
9 |
+
|
10 |
+
@app.route("/")
|
11 |
+
def home():
|
12 |
+
return "<h1>Lyrics Classifier</h1>"
|
13 |
+
|
14 |
+
@app.route('/api/', methods=['POST'])
|
15 |
+
def makecalc():
|
16 |
+
data = request.get_json()
|
17 |
+
prediction = np.array2string(model.predict(data))
|
18 |
+
|
19 |
+
return jsonify(prediction)
|
20 |
+
|
21 |
+
|
22 |
+
if __name__ == '__main__':
|
23 |
+
modelfile = '2179-proj.pickle'
|
24 |
+
model = p.load(open(modelfile, 'rb'))
|
25 |
+
app.run(debug=True, host='0.0.0.0')
|
vercel.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
"version": 2,
|
3 |
"builds": [
|
4 |
{
|
5 |
-
"src": "./
|
6 |
"use": "@vercel/python"
|
7 |
}
|
8 |
],
|
|
|
2 |
"version": 2,
|
3 |
"builds": [
|
4 |
{
|
5 |
+
"src": "./index.py",
|
6 |
"use": "@vercel/python"
|
7 |
}
|
8 |
],
|