Skip to content

Commit

Permalink
Update app_jupyter.py
Browse files Browse the repository at this point in the history
keep activate_simulation=False for online demos on NeurIPS datasets because we don't give the corresponding grid2op environments with test sets
  • Loading branch information
marota authored Jun 7, 2021
1 parent cd99c5b commit cc197ad
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions grid2viz/app_jupyter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
It will generate the layout of a given page and handle the routing
"""

activate_simulation=False #turn it to True to activate Simulation tab. You will need Grid2op related environment in additions to the scenario logs

import dash_bootstrap_components as dbc
import warnings
import sys
Expand All @@ -32,19 +34,6 @@
) # as overview_clbk
from grid2viz.src.macro.macro_clbk import register_callbacks_macro # as macro_clbk
from grid2viz.src.micro.micro_clbk import register_callbacks_micro # as micro_clbk
from grid2viz.src.simulation.simulation_clbk import register_callbacks_simulation

try:
from grid2viz.src.simulation.ExpertAssist import Assist
except (ImportError, ModuleNotFoundError):
from grid2viz.src.simulation.simulation_assist import EmptyAssist as Assist

warnings.warn(
"ExpertOp4Grid is not installed and the assist feature will not be available."
" To use the Assist feature, you can install ExpertOp4Grid by "
"\n\t{} -m pip install ExpertOp4Grid\n".format(sys.executable)
)

"""
End Warning
"""
Expand All @@ -55,7 +44,6 @@
app.server.secret_key = "Grid2Viz"

##create layout
activate_simulation=True
layout(app,activate_simulation=activate_simulation)


Expand All @@ -66,6 +54,19 @@
register_callbacks_macro(app)
register_callbacks_micro(app)
if activate_simulation:
from grid2viz.src.simulation.simulation_clbk import register_callbacks_simulation

try:
from grid2viz.src.simulation.ExpertAssist import Assist
except (ImportError, ModuleNotFoundError):
from grid2viz.src.simulation.simulation_assist import EmptyAssist as Assist

warnings.warn(
"ExpertOp4Grid is not installed and the assist feature will not be available."
" To use the Assist feature, you can install ExpertOp4Grid by "
"\n\t{} -m pip install ExpertOp4Grid\n".format(sys.executable)
)

assistant = Assist()
register_callbacks_simulation(app, assistant)
assistant.register_callbacks(app)
Expand Down

0 comments on commit cc197ad

Please sign in to comment.