snowzach / doods2

API for detecting objects in images and video streams using Tensorflow
MIT License
232 stars 30 forks source link

http URL for images generated by home assistant Ingress don't work #101

Closed prabhjotsbhatia-ca closed 7 months ago

prabhjotsbhatia-ca commented 7 months ago

Hi, I'm trying to pass on a URL for a camera snapshot generated by the go2rtc addon on Home Assistant. The URL is like this: http://192.168.yyy.xxx:8123/api/hassio_ingress/UJZVZiEwpEXh0gFx_XYZ3izYJ0JWUUnzOJtm54rZH1c/api/frame.jpeg?src=frontdoor_camera This results in an "500: Internal Server Error"

However, other local URLs like http://192.168.yyy.xxx:8123/api/image/serve/3b443a12278e6b08d7fab420e4fca954/512x512 work absolutely fine.

I tried using the webpage on a browser as well as the REST API by making a POST request in Insomnia. Here're the logs for the unsuccessful attempts:

2024-02-13 07:47:36,596 - uvicorn.access - INFO - 192.168.XXX.ZZZ:56247 - "POST /detect HTTP/1.1" 500
2024-02-13 07:47:36,597 - uvicorn.error - ERROR - Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
    result = await app(self.scope, self.receive, self.send)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/fastapi/applications.py", line 208, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.11/dist-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.11/dist-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc
  File "/usr/local/lib/python3.11/dist-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.11/dist-packages/prometheus_fastapi_instrumentator/middleware.py", line 169, in __call__
    raise exc
  File "/usr/local/lib/python3.11/dist-packages/prometheus_fastapi_instrumentator/middleware.py", line 167, in __call__
    await self.app(scope, receive, send_wrapper)
  File "/usr/local/lib/python3.11/dist-packages/starlette/exceptions.py", line 82, in __call__
    raise exc
  File "/usr/local/lib/python3.11/dist-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.11/dist-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.11/dist-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.11/dist-packages/starlette/routing.py", line 61, in app
    response = await func(request)
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/fastapi/routing.py", line 226, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/fastapi/routing.py", line 159, in run_endpoint_function
    return await dependant.call(**values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/doods/api.py", line 47, in detect
    detect_response = self.doods.detect(detect_request)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/doods/doods.py", line 119, in detect
    raise 'No Image'
TypeError: exceptions must derive from BaseException

Would really appreciate any help here.

EDIT: Fixed, it was a permissions error. Please feel free to delete.