diff --git a/latentscope/server/app.py b/latentscope/server/app.py index 7196def..d27811e 100644 --- a/latentscope/server/app.py +++ b/latentscope/server/app.py @@ -1,6 +1,8 @@ import re import os +import sys import json +import logging import argparse import pandas as pd import pkg_resources @@ -12,6 +14,9 @@ app = Flask(__name__) +app.logger.addHandler(logging.StreamHandler(sys.stderr)) +app.logger.setLevel(logging.INFO) + CORS(app) # DATA_DIR = update_data_dir(args.data_dir) @@ -81,10 +86,11 @@ def send_file(datasetPath): """ Given a list of indices (passed as a json array), return the rows from the dataset """ -@app.route('/api/indexed', methods=['GET']) +@app.route('/api/indexed', methods=['POST']) def indexed(): - dataset = request.args.get('dataset') - indices = json.loads(request.args.get('indices')) + data = request.get_json() + dataset = data['dataset'] + indices = data['indices'] if dataset not in DATAFRAMES: df = pd.read_parquet(os.path.join(DATA_DIR, dataset, "input.parquet")) DATAFRAMES[dataset] = df @@ -95,8 +101,6 @@ def indexed(): rows = df.iloc[indices] # send back the rows as json return rows.to_json(orient="records") - - @app.route('/', defaults={'path': ''}) @app.route('/') def catch_all(path): diff --git a/web/src/App.jsx b/web/src/App.jsx index ccb7757..5be532e 100644 --- a/web/src/App.jsx +++ b/web/src/App.jsx @@ -22,7 +22,8 @@ function App() {