.. include:: /rst/exports/alias.include .. include:: /rst/exports/roles.include .. _tutorials_dashboard_context_broker: ###################################################### Send data to the Context Broker with the AML Dashboard ###################################################### Background ========== The :term:`AML` Dashboard is a web-based tool that allows users to interact with the |aml| framework. This tutorial guides you through the process of sending data to the Context Broker and retrieving inferences using the *AML Dashboard*. .. figure:: /rst/figures/tutorials/context_broker_dashboard.png :align: center :width: 100% Prerequisites ============= Ensure you have installed the *AML Dashboard* using one of the following methods: - :ref:`Linux Installation ` - :ref:`Docker Image Installation ` For more information, check the :ref:`AML Dashboard Interfaces ` and :ref:`AML Dashboard Usage ` sections. Running the demo ================ To run the necessary components for interacting with the Context Broker using the |aml| Dashboard, follow these steps: Start the backend server ------------------------ To begin, you need to launch the backend server: 1. Navigate to the ``backend`` directory. .. code-block:: bash cd backend 2. Load the |amlip| environment. .. code-block:: bash source /AML-IP/install/setup.bash 3. Start the server: .. code-block:: bash python3 server.py Start the AML Dashboard ----------------------- Once the backend server is running, start the AML Dashboard frontend: 1. Navigate to the ``frontend/aml_dashboard`` directory. .. code-block:: bash cd frontend/aml_dashboard 2. Start the |aml| Dashboard: .. code-block:: bash npm run dev 3. Access the dashboard at `http://localhost:5173/ `__. Start the Context Broker ------------------------ To start the Context Broker, follow the instructions in `this document `__. Send data to the Context Broker =============================== Create a Fiware Node -------------------- To create a Fiware Node, follow these steps: 1. In the |aml| Dashboard, go to the ``Context Broker`` tab. 2. Specify the necessary parameters for the Fiware Node creation, including the Context Broker entity ID and attributes. 3. Click on the ``Create`` button in the *Fiware Node*. 4. Once the node is successfully created, the *Fiware Node Status* will update to **Created !**. Upload data ----------- To send data to the Context Broker, follow these steps: 1. Upload an image file from your computer by clicking on the ``Upload a file`` button and selecting an image. 2. After uploading, click on the ``Post data`` button in the *Context Broker Data* to send the image to the Context Broker. 3. Once the data is sent, the status will change to **Sended !** in the *Data Status*. Receive the solution ==================== Start an Inference Node ----------------------- 1. Navigate to the ``backend`` directory. .. code-block:: bash cd backend 2. Load the |amlip| environment. .. code-block:: bash source /AML-IP/install/setup.bash 3. Start the Inference Node: .. code-block:: bash python3 inference.py Retrieve the solution --------------------- 1. The inference result (solution) will be displayed in the *Context Broker Solution* section. 2. The *Solution Status* will change to **Solution received !** to confirm that the inference has been successfully retrieved. .. raw:: html .. note:: Currently, each Fiware Node only supports handling one entity of the Context Broker. The data associated with that entity ID cannot be changed once initialized, meaning each Fiware Node will manage a single inference process. Troubleshooting =============== If you encounter the following error when sending large files or data to the Context Broker: .. code-block:: bash requests.exceptions.HTTPError: 413 Client Error: Content Too Large for url: http://localhost:1026/v2/entities This error indicates that the request payload is too large for the server to process. You may need to configure the Context Broker to accept larger payloads. To address this issue, you can adjust the following flags in the Context Broker configuration: * ``inReqPayloadMaxSize``: Increase this value to allow larger incoming request payloads. * ``outReqMsgMaxSize``: Adjust this value to handle larger outgoing response messages. * ``logInfoPayloadMaxSize``: Configure this flag to manage the size of payloads in log entries. * ``logLineMaxSize``: Modify this value to accommodate longer lines in log files. Set each flag according to the size of the data you need to handle.