-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathnfl.py
More file actions
27 lines (22 loc) · 662 Bytes
/
Copy pathnfl.py
File metadata and controls
27 lines (22 loc) · 662 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
from flask import Flask
import subprocess
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
app = Flask(__name__)
color = {}
color["\n"] = "<br>"
color["[0m"] = "</font>"
color["[36m"] = "<font color='blue'>"
color["[32m"] = "<font color='green'>"
color["[33m"] = "<font color='gold'>"
color["[35m"] = "<font color='orange'>"
color["[31m"] = "<font color='red'>"
@app.route("/")
def root():
proc = subprocess.Popen(["python2", dir_path + "/predict.py"], stdout=subprocess.PIPE)
(out, err) = proc.communicate()
for i in color:
out = out.replace(i,color[i])
return out, 200
if __name__ == "__main__":
app.run(host='0.0.0.0', port=5001)