diff --git a/app.py b/app.py index b86c821a0b5517845bbfc85d9bdb5257053cd447..b76c60b5c338a1e0bd7b30e7d129a89675b5835d 100644 --- a/app.py +++ b/app.py @@ -11,7 +11,8 @@ import pysmile import sys import json print(sys.path) -from src import constants +from src import constants, pysmile_license + import mysql.connector from flask import Flask, request, render_template @@ -19,6 +20,16 @@ from flask import Flask, request, render_template from src import configuration, recommender, database, planner, modal_choice app = Flask(__name__) + +model = pickle.load(open('model.pkcls', 'rb')) +""" +net = pysmile.Network() +""" + +#CORS +from flask_cors import CORS +cors = CORS(app, resources={r"/*": {"origins": "*"}}) + cnx = None @@ -29,6 +40,17 @@ def index(): # MODAL CHOICE: ------------------------------------------------------------------------------------------------------- +@app.get("/modal_choice/getConfigurationFile") +def modal_choice_getconfigurationfile(): + """ + We ask for actions based on popularity of the actions + :return: json + """ + return modal_choice.modal_choice_getconfigurationfile(cnx, request) + + + + @app.get("/modal_choice/estimation") def modal_choice_estimation(): """ @@ -265,6 +287,10 @@ def database_store_kpi_relative_area(): # MAIN: ---------------------------------------------------------------------------------------------------------------- if __name__ == "__main__": - model = pickle.load(open('model.pkcls', 'rb')) + """model = pickle.load(open('model.pkcls', 'rb')) + net = pysmile.Network() + net.read_file("URBANITE_ModalChoice.xdsl"); + """ cnx = mysql.connector.connect(**constants.DDBB_CONFIG) app.run(debug=True, host='0.0.0.0') +