Skip to content

Commit 163a756

Browse files
authored
bug: fix variables default values (#41)
1 parent 3d0f510 commit 163a756

File tree

9 files changed

+32
-28
lines changed

9 files changed

+32
-28
lines changed

src/arduino/app_bricks/image_classification/brick_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ variables:
1313
- name: EI_CLASSIFICATION_MODEL
1414
description: Path to the model file
1515
hidden: true
16-
default_value: /models/ootb/ei/mobilenet_v2_1.0_224_image_classification.eim
16+
default_value: /models/ootb/ei/mobilenet-v2-224px.eim
1717
- name: CUSTOM_MODEL_PATH
1818
description: Path to the custom model directory
1919
hidden: true

src/arduino/app_bricks/object_detection/brick_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ variables:
1313
- name: EI_OBJ_DETECTION_MODEL
1414
description: Path to the model file
1515
hidden: true
16-
default_value: /models/ootb/ei/yolox-object-detection.eim
16+
default_value: /models/ootb/ei/yolo-x-nano.eim
1717
- name: CUSTOM_MODEL_PATH
1818
description: Path to the custom model directory
1919
hidden: true

src/arduino/app_bricks/vibration_anomaly_detection/brick_config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,16 @@ requires_model: true
99
model: fan-anomaly-detection
1010
model_configuration_variables:
1111
- EI_VIBRATION_ANOMALY_DETECTION_MODEL
12+
variables:
13+
- name: EI_VIBRATION_ANOMALY_DETECTION_MODEL
14+
description: Path to the model file
15+
hidden: true
16+
default_value: /models/ootb/ei/fan-anomaly-detection.eim
17+
- name: CUSTOM_MODEL_PATH
18+
description: Path to the custom model directory
19+
hidden: true
20+
default_value: /home/arduino/.arduino-bricks/ei-models
21+
- name: BIND_ADDRESS
22+
description: Bind address
23+
hidden: true
24+
default_value: 127.0.0.1

src/arduino/app_bricks/video_imageclassification/brick_compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ services:
1111
volumes:
1212
- "${CUSTOM_MODEL_PATH:-/home/arduino/.arduino-bricks/ei-models/}:${CUSTOM_MODEL_PATH:-/home/arduino/.arduino-bricks/ei-models/}"
1313
- "/run/udev:/run/udev"
14-
command: ["--model-file", "${EI_V_CLASSIFICATION_MODEL:-/models/ootb/ei/mobilenet-v2-224px.eim}", "--dont-print-predictions", "--mode", "streaming", "--preview-original-resolution", "--camera", "${VIDEO_DEVICE:-/dev/video1}"]
14+
command: ["--model-file", "${EI_CLASSIFICATION_MODEL:-/models/ootb/ei/mobilenet-v2-224px.eim}", "--dont-print-predictions", "--mode", "streaming", "--preview-original-resolution", "--camera", "${VIDEO_DEVICE:-/dev/video1}"]
1515
healthcheck:
1616
test: [ "CMD-SHELL", "wget -q --spider http://ei-video-classification-runner:4912 || exit 1" ]
1717
interval: 2s

src/arduino/app_bricks/video_imageclassification/brick_config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ required_devices:
1313
- camera
1414
model: mobilenet-image-classification
1515
model_configuration_variables:
16-
- EI_V_CLASSIFICATION_MODEL
16+
- EI_CLASSIFICATION_MODEL
1717
variables:
18-
- name: EI_V_CLASSIFICATION_MODEL
18+
- name: EI_CLASSIFICATION_MODEL
1919
description: Path to the model file
2020
hidden: true
21-
default_value: /models/ootb/ei/mobilenet_v2_1.0_224_image_classification.eim
21+
default_value: /models/ootb/ei/mobilenet-v2-224px.eim
2222
- name: CUSTOM_MODEL_PATH
2323
description: Path to the custom model directory
2424
hidden: true
2525
default_value: /home/arduino/.arduino-bricks/ei-models
2626
- name: BIND_ADDRESS
2727
description: Bind address
2828
hidden: true
29-
default_value: 127.0.0.1
29+
default_value: 0.0.0.0
3030
- name: VIDEO_DEVICE
3131
description: Video device path
3232
hidden: true

src/arduino/app_bricks/video_objectdetection/brick_compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ services:
1111
volumes:
1212
- "${CUSTOM_MODEL_PATH:-/home/arduino/.arduino-bricks/ei-models/}:${CUSTOM_MODEL_PATH:-/home/arduino/.arduino-bricks/ei-models/}"
1313
- "/run/udev:/run/udev"
14-
command: ["--model-file", "${EI_V_OBJ_DETECTION_MODEL:-/models/ootb/ei/yolo-x-nano.eim}", "--dont-print-predictions", "--mode", "streaming", "--preview-original-resolution", "--camera", "${VIDEO_DEVICE:-/dev/video1}"]
14+
command: ["--model-file", "${EI_OBJ_DETECTION_MODEL:-/models/ootb/ei/yolo-x-nano.eim}", "--dont-print-predictions", "--mode", "streaming", "--preview-original-resolution", "--camera", "${VIDEO_DEVICE:-/dev/video1}"]
1515
healthcheck:
1616
test: [ "CMD-SHELL", "wget -q --spider http://ei-video-obj-detection-runner:4912 || exit 1" ]
1717
interval: 2s

src/arduino/app_bricks/video_objectdetection/brick_config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ required_devices:
1212
- camera
1313
model: yolox-object-detection
1414
model_configuration_variables:
15-
- EI_V_OBJ_DETECTION_MODEL
15+
- EI_OBJ_DETECTION_MODEL
1616
variables:
17-
- name: EI_V_OBJ_DETECTION_MODEL
17+
- name: EI_OBJ_DETECTION_MODEL
1818
description: Path to the model file
1919
hidden: true
20-
default_value: /models/ootb/ei/yolox-object-detection.eim
20+
default_value: /models/ootb/ei/yolo-x-nano.eim
2121
- name: CUSTOM_MODEL_PATH
2222
description: Path to the custom model directory
2323
hidden: true
2424
default_value: /home/arduino/.arduino-bricks/ei-models
2525
- name: BIND_ADDRESS
2626
description: Bind address
2727
hidden: true
28-
default_value: 127.0.0.1
28+
default_value: 0.0.0.0
2929
- name: VIDEO_DEVICE
3030
description: Video device path
3131
hidden: true

src/arduino/app_internal/core/module.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,19 +152,22 @@ def __str__(self):
152152

153153

154154
class EnvVariable:
155-
def __init__(self, name: str, description: str, default_value: str = None):
155+
def __init__(self, name: str, description: str, default_value: str = None, hidden: bool = False):
156156
"""Represents a variable in brick_config file."""
157157
self.name = name
158158
self.default_value = default_value
159159
self.description = description
160+
self.hidden = hidden
160161

161162
def to_dict(self) -> dict:
162163
"""Converts the EnvVariable object to a dictionary."""
163-
dict_out = {"name": self.name, "default_value": self.default_value, "description": self.description}
164+
dict_out = {"name": self.name, "default_value": self.default_value, "description": self.description, "hidden": self.hidden}
164165
if self.default_value is None or self.default_value == "":
165166
del dict_out["default_value"]
166167
if self.description is None or self.description == "":
167168
del dict_out["description"]
169+
if not self.hidden:
170+
del dict_out["hidden"]
168171
return dict_out
169172

170173
def __str__(self):

src/arduino/app_tools/module_listing.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
from urllib.parse import urlparse
1515
from typing import List, Dict, Optional
1616
from arduino.app_internal.core.module import (
17-
load_module_supported_variables,
18-
ModuleVariable,
1917
_update_compose_release_version,
2018
EnvVariable,
2119
)
@@ -54,9 +52,6 @@ def __init__(
5452
self.compose_file: Optional[str] = self.get_compose_file()
5553
self.readme_file: Optional[str] = self.get_readme_file()
5654
self.require_container: bool = self.compose_file is not None
57-
self.docker_compose_variables: Optional[List[ModuleVariable]] = (
58-
load_module_supported_variables(self.compose_file) if self.require_container else None
59-
)
6055
self.model_name: str = model_name
6156
self.require_model: bool = model_name != ""
6257
self.category = category
@@ -83,21 +78,14 @@ def to_dict(self) -> dict:
8378
if self.required_device_classes:
8479
out_dict["required_devices"] = self.required_device_classes
8580

86-
if self.require_container:
87-
var_to_add: List[ModuleVariable] = []
88-
for var in self.docker_compose_variables:
89-
if var.name != "APPSLAB_VERSION" and var.name != "DOCKER_REGISTRY_BASE" and var.name != "BIND_ADDRESS":
90-
var_to_add.append(var)
91-
vars_list: List[Dict] = [var.to_dict() for var in var_to_add]
92-
out_dict["variables"] = vars_list
93-
9481
if self.env_variables and len(self.env_variables) > 0:
9582
additional_vars: List[EnvVariable] = []
9683
for var in self.env_variables:
9784
name = var.get("name")
9885
description = var.get("description", "")
9986
default = var.get("default_value", "")
100-
additional_vars.append(EnvVariable(name, description, default))
87+
hidden = var.get("hidden", False)
88+
additional_vars.append(EnvVariable(name, description, default, hidden))
10189
if "variables" in out_dict:
10290
out_dict["variables"].extend([var.to_dict() for var in additional_vars])
10391
else:

0 commit comments

Comments
 (0)