Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ variables:
- name: EI_CLASSIFICATION_MODEL
description: Path to the model file
hidden: true
default_value: /models/ootb/ei/mobilenet_v2_1.0_224_image_classification.eim
default_value: /models/ootb/ei/mobilenet-v2-224px.eim
- name: CUSTOM_MODEL_PATH
description: Path to the custom model directory
hidden: true
Expand Down
2 changes: 1 addition & 1 deletion src/arduino/app_bricks/object_detection/brick_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ variables:
- name: EI_OBJ_DETECTION_MODEL
description: Path to the model file
hidden: true
default_value: /models/ootb/ei/yolox-object-detection.eim
default_value: /models/ootb/ei/yolo-x-nano.eim
- name: CUSTOM_MODEL_PATH
description: Path to the custom model directory
hidden: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,16 @@ requires_model: true
model: fan-anomaly-detection
model_configuration_variables:
- EI_VIBRATION_ANOMALY_DETECTION_MODEL
variables:
- name: EI_VIBRATION_ANOMALY_DETECTION_MODEL
description: Path to the model file
hidden: true
default_value: /models/ootb/ei/fan-anomaly-detection.eim
- name: CUSTOM_MODEL_PATH
description: Path to the custom model directory
hidden: true
default_value: /home/arduino/.arduino-bricks/ei-models
- name: BIND_ADDRESS
description: Bind address
hidden: true
default_value: 127.0.0.1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
volumes:
- "${CUSTOM_MODEL_PATH:-/home/arduino/.arduino-bricks/ei-models/}:${CUSTOM_MODEL_PATH:-/home/arduino/.arduino-bricks/ei-models/}"
- "/run/udev:/run/udev"
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}"]
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}"]
healthcheck:
test: [ "CMD-SHELL", "wget -q --spider http://ei-video-classification-runner:4912 || exit 1" ]
interval: 2s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ required_devices:
- camera
model: mobilenet-image-classification
model_configuration_variables:
- EI_V_CLASSIFICATION_MODEL
- EI_CLASSIFICATION_MODEL
variables:
- name: EI_V_CLASSIFICATION_MODEL
- name: EI_CLASSIFICATION_MODEL
description: Path to the model file
hidden: true
default_value: /models/ootb/ei/mobilenet_v2_1.0_224_image_classification.eim
default_value: /models/ootb/ei/mobilenet-v2-224px.eim
- name: CUSTOM_MODEL_PATH
description: Path to the custom model directory
hidden: true
default_value: /home/arduino/.arduino-bricks/ei-models
- name: BIND_ADDRESS
description: Bind address
hidden: true
default_value: 127.0.0.1
default_value: 0.0.0.0
- name: VIDEO_DEVICE
description: Video device path
hidden: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
volumes:
- "${CUSTOM_MODEL_PATH:-/home/arduino/.arduino-bricks/ei-models/}:${CUSTOM_MODEL_PATH:-/home/arduino/.arduino-bricks/ei-models/}"
- "/run/udev:/run/udev"
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}"]
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}"]
healthcheck:
test: [ "CMD-SHELL", "wget -q --spider http://ei-video-obj-detection-runner:4912 || exit 1" ]
interval: 2s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ required_devices:
- camera
model: yolox-object-detection
model_configuration_variables:
- EI_V_OBJ_DETECTION_MODEL
- EI_OBJ_DETECTION_MODEL
variables:
- name: EI_V_OBJ_DETECTION_MODEL
- name: EI_OBJ_DETECTION_MODEL
description: Path to the model file
hidden: true
default_value: /models/ootb/ei/yolox-object-detection.eim
default_value: /models/ootb/ei/yolo-x-nano.eim
- name: CUSTOM_MODEL_PATH
description: Path to the custom model directory
hidden: true
default_value: /home/arduino/.arduino-bricks/ei-models
- name: BIND_ADDRESS
description: Bind address
hidden: true
default_value: 127.0.0.1
default_value: 0.0.0.0
- name: VIDEO_DEVICE
description: Video device path
hidden: true
Expand Down
7 changes: 5 additions & 2 deletions src/arduino/app_internal/core/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,22 @@ def __str__(self):


class EnvVariable:
def __init__(self, name: str, description: str, default_value: str = None):
def __init__(self, name: str, description: str, default_value: str = None, hidden: bool = False):
"""Represents a variable in brick_config file."""
self.name = name
self.default_value = default_value
self.description = description
self.hidden = hidden

def to_dict(self) -> dict:
"""Converts the EnvVariable object to a dictionary."""
dict_out = {"name": self.name, "default_value": self.default_value, "description": self.description}
dict_out = {"name": self.name, "default_value": self.default_value, "description": self.description, "hidden": self.hidden}
if self.default_value is None or self.default_value == "":
del dict_out["default_value"]
if self.description is None or self.description == "":
del dict_out["description"]
if not self.hidden:
del dict_out["hidden"]
return dict_out

def __str__(self):
Expand Down
16 changes: 2 additions & 14 deletions src/arduino/app_tools/module_listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
from urllib.parse import urlparse
from typing import List, Dict, Optional
from arduino.app_internal.core.module import (
load_module_supported_variables,
ModuleVariable,
_update_compose_release_version,
EnvVariable,
)
Expand Down Expand Up @@ -54,9 +52,6 @@ def __init__(
self.compose_file: Optional[str] = self.get_compose_file()
self.readme_file: Optional[str] = self.get_readme_file()
self.require_container: bool = self.compose_file is not None
self.docker_compose_variables: Optional[List[ModuleVariable]] = (
load_module_supported_variables(self.compose_file) if self.require_container else None
)
self.model_name: str = model_name
self.require_model: bool = model_name != ""
self.category = category
Expand All @@ -83,21 +78,14 @@ def to_dict(self) -> dict:
if self.required_device_classes:
out_dict["required_devices"] = self.required_device_classes

if self.require_container:
var_to_add: List[ModuleVariable] = []
for var in self.docker_compose_variables:
if var.name != "APPSLAB_VERSION" and var.name != "DOCKER_REGISTRY_BASE" and var.name != "BIND_ADDRESS":
var_to_add.append(var)
vars_list: List[Dict] = [var.to_dict() for var in var_to_add]
out_dict["variables"] = vars_list

if self.env_variables and len(self.env_variables) > 0:
additional_vars: List[EnvVariable] = []
for var in self.env_variables:
name = var.get("name")
description = var.get("description", "")
default = var.get("default_value", "")
additional_vars.append(EnvVariable(name, description, default))
hidden = var.get("hidden", False)
additional_vars.append(EnvVariable(name, description, default, hidden))
if "variables" in out_dict:
out_dict["variables"].extend([var.to_dict() for var in additional_vars])
else:
Expand Down