Skip to content

Commit d69d4fd

Browse files
author
ChrisMaunder
committed
A couple of errors fixed
1 parent 8841cc3 commit d69d4fd

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

custom_components/codeproject_ai_object/image_processing.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
from typing import Tuple, Dict, List
1515
from pathlib import Path
1616

17-
from PIL import Image, ImageDraw
17+
from PIL import Image, ImageDraw, UnidentifiedImageError
18+
import voluptuous as vol
1819

1920
import codeprojectai.core as cpai
2021

2122
import homeassistant.helpers.config_validation as cv
2223
import homeassistant.util.dt as dt_util
23-
import voluptuous as vol
2424
from homeassistant.util.pil import draw_box
2525
from homeassistant.components.image_processing import (
2626
ATTR_CONFIDENCE,
@@ -63,7 +63,6 @@
6363
OBJECT_TYPES = [ANIMAL, OTHER, PERSON, VEHICLE]
6464

6565

66-
CONF_API_KEY = "api_key"
6766
CONF_TARGET = "target"
6867
CONF_TARGETS = "targets"
6968
CONF_TIMEOUT = "timeout"
@@ -81,7 +80,6 @@
8180
CONF_CROP_ROI = "crop_to_roi"
8281

8382
DATETIME_FORMAT = "%Y-%m-%d_%H-%M-%S-%f"
84-
DEFAULT_API_KEY = ""
8583
DEFAULT_TARGETS = [{CONF_TARGET: PERSON}]
8684
DEFAULT_TIMEOUT = 10
8785
DEFAULT_ROI_Y_MIN = 0.0
@@ -122,7 +120,7 @@
122120
{
123121
vol.Required(CONF_IP_ADDRESS): cv.string,
124122
vol.Required(CONF_PORT): cv.port,
125-
vol.Optional(CONF_API_KEY, default=DEFAULT_API_KEY): cv.string,
123+
// vol.Optional(CONF_API_KEY, default=DEFAULT_API_KEY): cv.string,
126124
vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT): cv.positive_int,
127125
vol.Optional(CONF_CUSTOM_MODEL, default=""): cv.string,
128126
vol.Optional(CONF_TARGETS, default=DEFAULT_TARGETS): vol.All(
@@ -225,7 +223,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
225223
object_entity = ObjectClassifyEntity(
226224
ip_address=config.get(CONF_IP_ADDRESS),
227225
port=config.get(CONF_PORT),
228-
api_key=config.get(CONF_API_KEY),
229226
timeout=config.get(CONF_TIMEOUT),
230227
custom_model=config.get(CONF_CUSTOM_MODEL),
231228
targets=config.get(CONF_TARGETS),
@@ -255,7 +252,6 @@ def __init__(
255252
self,
256253
ip_address,
257254
port,
258-
api_key,
259255
timeout,
260256
custom_model,
261257
targets,
@@ -279,7 +275,6 @@ def __init__(
279275
self._cpai_object = cpai.CodeProjectAIObject(
280276
ip=ip_address,
281277
port=port,
282-
api_key=api_key,
283278
timeout=timeout,
284279
min_confidence=MIN_CONFIDENCE,
285280
custom_model=custom_model,

0 commit comments

Comments
 (0)