-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
27 lines (21 loc) · 708 Bytes
/
app.py
File metadata and controls
27 lines (21 loc) · 708 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
import os
import flask
import predict
app = flask.Flask(__name__)
@app.route('/')
def index():
return flask.render_template("index.html")
@app.route("/uploader", methods = ["POST"])
def upload_file():
trace = flask.request.files["trace"]
with open("trace_temp.json", "wb") as f:
f.write(trace.read())
model = flask.request.files["model"]
with open("model_temp.mdl", "wb") as f:
f.write(model.read())
typeClass = predict.Prediction("trace_temp.json", "model_temp.mdl")
os.remove("trace_temp.json")
os.remove("model_temp.mdl")
return flask.render_template("prediction.html", typeClass = typeClass)
if __name__ == "__main__":
app.run(debug=True)