Skip to content

Commit

Permalink
Don't fail if deepstack detector times out (blakeblackshear#8979)
Browse files Browse the repository at this point in the history
  • Loading branch information
NickM-27 authored Dec 15, 2023
1 parent e390533 commit c35c7da
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions frigate/detectors/plugins/deepstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,18 @@ def detect_raw(self, tensor_input):
image.save(output, format="JPEG")
image_bytes = output.getvalue()
data = {"api_key": self.api_key}
response = requests.post(
self.api_url,
data=data,
files={"image": image_bytes},
timeout=self.api_timeout,
)

try:
response = requests.post(
self.api_url,
data=data,
files={"image": image_bytes},
timeout=self.api_timeout,
)
except requests.exceptions.RequestException:
logger.error("Error calling deepstack API")
return np.zeros((20, 6), np.float32)

response_json = response.json()
detections = np.zeros((20, 6), np.float32)
if response_json.get("predictions") is None:
Expand Down

0 comments on commit c35c7da

Please sign in to comment.