From 0b4200f4cbc13598271d975fac5d0b0aa8cda2f1 Mon Sep 17 00:00:00 2001
From: "Campos Cordobes, Sergio" <sergio.campos@tecnalia.com>
Date: Mon, 27 Mar 2023 07:47:04 +0200
Subject: [PATCH] Update app.py

---
 app.py | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/app.py b/app.py
index b86c821..b76c60b 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')
+
-- 
GitLab