Check prediction feature flag when entering crypto/pred

This commit is contained in:
Theodore Aptekarev
2022-03-26 01:30:08 +03:00
parent 837e230cd6
commit 1c7ea3edc5

View File

@@ -437,28 +437,34 @@ class CryptoController(CryptoBaseController):
@log_start_end(log=logger)
def call_pred(self, _):
"""Process pred command"""
if self.coin:
try:
from gamestonk_terminal.cryptocurrency.prediction_techniques import (
pred_controller,
)
if self.current_interval != "1day":
console.print("Only interval `1day` is possible for now.\n")
else:
self.queue = self.load_class(
pred_controller.PredictionTechniquesController,
self.coin,
self.current_df,
self.queue,
if gtff.ENABLE_PREDICT:
if self.coin:
try:
from gamestonk_terminal.cryptocurrency.prediction_techniques import (
pred_controller,
)
except ImportError:
logger.exception("Tensorflow not available")
console.print("[red]Run pip install tensorflow to continue[/red]\n")
if self.current_interval != "1day":
console.print("Only interval `1day` is possible for now.\n")
else:
self.queue = self.load_class(
pred_controller.PredictionTechniquesController,
self.coin,
self.current_df,
self.queue,
)
except ImportError:
logger.exception("Tensorflow not available")
console.print("[red]Run pip install tensorflow to continue[/red]\n")
else:
console.print(
"No coin selected. Use 'load' to load the coin you want to look at.\n"
)
else:
console.print(
"No coin selected. Use 'load' to load the coin you want to look at.\n"
"Predict is disabled. Check ENABLE_PREDICT flag on feature_flags.py",
"\n",
)
@log_start_end(log=logger)