diff options
author | Sonja Galovic <galovicsonja@gmail.com> | 2022-03-13 23:30:59 +0100 |
---|---|---|
committer | Sonja Galovic <galovicsonja@gmail.com> | 2022-03-13 23:30:59 +0100 |
commit | 3cbcc624643f2e765bc972273cd271320d79972c (patch) | |
tree | c09c5329ad63c932cc8bf44f0f70521d1f678fc0 /backend/microservice/PythonServer/project/api/api.py | |
parent | 24679faf85c509e04c86f00dae1e6dbc08ce6e2a (diff) | |
parent | f1303df5d40e29e77e64d36b1b382609f5a3741c (diff) |
Merge branch 'dev' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into dev
Diffstat (limited to 'backend/microservice/PythonServer/project/api/api.py')
-rw-r--r-- | backend/microservice/PythonServer/project/api/api.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/backend/microservice/PythonServer/project/api/api.py b/backend/microservice/PythonServer/project/api/api.py new file mode 100644 index 00000000..1f4afdeb --- /dev/null +++ b/backend/microservice/PythonServer/project/api/api.py @@ -0,0 +1,32 @@ +from copyreg import constructor +import flask +from flask import request, jsonify, render_template +from sklearn.preprocessing import LabelEncoder +import tensorflow as tf +import pandas as pd +import keras +import csv +import json + + +app = flask.Flask(__name__) +app.config["DEBUG"] = True + + +@app.route('/', methods = ['GET', 'POST']) +def index(): + return render_template('index.html') + +@app.route('/data', methods = ['GET', 'POST']) +def data(): + if request.method == 'POST': + f = request.json['filepath'] + data = [] + with open(f) as file: + csvfile = csv.reader(file) + for row in csvfile: + data.append(row) + data = pd.DataFrame(data) + print(data) + return render_template('data.html', data = data.to_html(header=False, index=False)) +app.run()
\ No newline at end of file |