From 6349272534907e3d7891818b6b57ee938b18c3b3 Mon Sep 17 00:00:00 2001 From: Luka Date: Fri, 14 Jan 2022 09:43:50 +0100 Subject: [PATCH] Cleaning code --- app.py | 37 +++---------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/app.py b/app.py index 364d158..a5c91f4 100644 --- a/app.py +++ b/app.py @@ -1,7 +1,5 @@ -from datetime import timedelta - import torch -from flask import Flask, request, jsonify, session +from flask import Flask, request import classla import gc @@ -24,41 +22,12 @@ nlp_nonstandard_JOS = classla.Pipeline('sl', processors={ app = Flask(__name__) app.config['SESSION_TYPE'] = 'filesystem' app.config['SECRET_KEY'] = "78df924389h138g01308ghj0d913" -# app.config['SESSION_PERMANENT']= False -# @app.before_request -# def make_session_permanent(): -# session.permanent = True -# app.permanent_session_lifetime = timedelta(seconds=20) -# # app.permanent_session_lifetime = timedelta(minutes=1) - @app.route('/') def hello_world(): - return 'This is my first API call!' + return 'API is running...' -# @app.route('/run', methods=['GET', "POST"]) -# def run(): -# if 'settings' not in session: -# return jsonify({'status': 'ERROR', 'details': 'No settings uploaded!'}) -# -# input_json = request.get_json(force=True) -# doc = session['nlp'](input_json['text']) -# -# return doc.to_conll() -# -# # return 'NOT IN SESSION!\n' - -# @app.route('/upload-settings', methods=['POST']) -# def upload_settings(): -# input_json = request.get_json(force=True) -# try: -# settings = input_json['settings'] -# session['nlp_id'] = classla.Pipeline(**settings) -# except: -# return jsonify({'status': 'ERROR', 'details': 'Incorrect settings!'}) -# -# return jsonify({'status': 'OK'}) @app.route('/custom-settings', methods=["POST"]) def custom_settings(): @@ -104,4 +73,4 @@ def nonstandard_jos(): if __name__ == '__main__': - app.run(host="0.0.0.0", debug=True) + app.run(host="0.0.0.0")