aboutsummaryrefslogtreecommitdiff
path: root/backend/microservice/PythonServer/project/api/api.py
diff options
context:
space:
mode:
Diffstat (limited to 'backend/microservice/PythonServer/project/api/api.py')
-rw-r--r--backend/microservice/PythonServer/project/api/api.py32
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