<filename>src/controller/controller.py<gh_stars>0
from typing import Dict, Optional

from src.controller.suggestor import Suggestor
from src.model import BaseModel, Model
from src.view.view import View


class Controller(Suggestor):
    """
    Connects activity suggestion model to user prompt and returns results to
    display
    """
    def __init__(self):
        self._view: Optional[View] = None
        self._model: Optional[BaseModel] = None

    @property
    def view(self) -> View:
        """Connects to stdout"""
        if self._view is None:
            self._view = View(...)
        return self._view

    @property
    def model(self) -> BaseModel:
        """Connection to the backend ML model"""
        if self._model is None:
            self._model = Model(...)
        return self._model

    def suggest_activity(self) -> None:
        """Suggest a fun activity for `user` to do today.
        """
        # Get daily profile
        profile: Dict[str, ...] = self.view.build_profile()

        # Predict on the profile
        activity: str = self.model.predict(profile)

        # Display on the frontend
        self.view.display_output(activity)

<filename>src/controller/controller.py<gh_stars>0
from typing import Dict, Optional

from src.controller.suggestor import Suggestor
from src.model import BaseModel, Model
from src.view.view import View


class Controller(Suggestor):
    """
    Connects activity suggestion model to user prompt and returns results to
    display
    """
    def __init__(self):
        self._view: Optional[View] = None
        self._model: Optional[BaseModel] = None

    @property
    def view(self) -> View:
        """Connects to stdout"""
        if self._view is None:
            self._view = View(...)
        return self._view

    @property
    def model(self) -> BaseModel:
        """Connection to the backend ML model"""
        if self._model is None:
            self._model = Model(...)
        return self._model

    def suggest_activity(self) -> None:
        """Suggest a fun activity for `user` to do today.
        """
        # Get daily profile
        profile: Dict[str, ...] = self.view.build_profile()

        # Predict on the profile
        activity: str = self.model.predict(profile)

        # Display on the frontend
        self.view.display_output(activity)

Connects activity suggestion model to user prompt and returns results to     display Connects to stdout Connection to the backend ML model Suggest a fun activity for `user` to do today. # Get daily profile # Predict on the profile # Display on the frontend