Skip to content

Commit 74150d7

Browse files
committed
improvement
1 parent 663a6dc commit 74150d7

File tree

1 file changed

+5
-3
lines changed
  • src/arduino/app_internal/core

1 file changed

+5
-3
lines changed

src/arduino/app_internal/core/ei.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def infer_from_features(cls, features: list) -> dict | None:
129129
"""
130130
try:
131131
url = cls._get_ei_url()
132-
model_info = cls.get_model_info()
132+
model_info = cls.get_model_info(url)
133133
features = features[: int(model_info.input_features_count)]
134134

135135
response = requests.post(f"{url}/api/features", json={"features": features})
@@ -143,16 +143,18 @@ def infer_from_features(cls, features: list) -> dict | None:
143143
return None
144144

145145
@classmethod
146-
def get_model_info(cls) -> EdgeImpulseModelInfo | None:
146+
def get_model_info(cls, url: str = None) -> EdgeImpulseModelInfo | None:
147147
"""Get model information from the Edge Impulse API.
148148
149149
Args:
150150
cls: The class method caller.
151+
url (str): The base URL of the Edge Impulse API. If None, it will be determined automatically.
151152
152153
Returns:
153154
model_info (EdgeImpulseModelInfo | None): An instance of EdgeImpulseModelInfo containing model details, None if an error occurs.
154155
"""
155-
url = cls._get_ei_url()
156+
if not url:
157+
url = cls._get_ei_url()
156158

157159
http_client = HttpClient(total_retries=6) # Initialize the HTTP client with retry logic
158160
try:

0 commit comments

Comments
 (0)