ksugar / qupath-extension-cellsparse

QuPath extension for Cellsparse
GNU General Public License v3.0
14 stars 1 forks source link

500 Internal Server Error #3

Open PierreHNR opened 1 year ago

PierreHNR commented 1 year ago

Hello,

Thanks a lot for all your work! I followed the installation, but when I try to run Cellpose or Stardist algorythm, I get an "500 Internal Server Error" in Qupath. For your information, I am able to run SAM (even if I have a message that no GPU support is found) in Qupath thanks to your instructions.

Here is the full message in the command prompt:

(cellsparse-api) C:\Users\Pierre.HENER>uvicorn cellsparse_api.main:app INFO: Started server process [20576] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) INFO: 127.0.0.1:63090 - "POST /sam/ HTTP/1.1" 404 Not Found 2023-06-23 16:40:42,473 [INFO] WRITING LOG OUTPUT TO C:\Users\Pierre.HENER.cellpose\run.log INFO: 127.0.0.1:63098 - "POST /cellpose/ HTTP/1.1" 500 Internal Server Error ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\uvicorn\protocols\http\httptools_impl.py", line 435, in run_asgi result = await app( # type: ignore[func-returns-value] File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in call return await self.app(scope, receive, send) File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\fastapi\applications.py", line 276, in call await super().call(scope, receive, send) File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\starlette\applications.py", line 122, in call await self.middleware_stack(scope, receive, send) File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\starlette\middleware\errors.py", line 184, in call raise exc File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\starlette\middleware\errors.py", line 162, in call await self.app(scope, receive, _send) File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\starlette\middleware\exceptions.py", line 79, in call raise exc File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\starlette\middleware\exceptions.py", line 68, in call await self.app(scope, receive, sender) File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in call raise e File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in call await self.app(scope, receive, send) File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\starlette\routing.py", line 718, in call await route.handle(scope, receive, send) File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\starlette\routing.py", line 276, in handle await self.app(scope, receive, send) File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\starlette\routing.py", line 66, in app response = await func(request) File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\fastapi\routing.py", line 237, in app raw_response = await run_endpoint_function( File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\fastapi\routing.py", line 163, in run_endpoint_function return await dependant.call(**values) File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\cellsparse_api\main.py", line 175, in cellpose return run( File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\cellsparse_api\main.py", line 42, in run img = normalize(decode_image(b64img), 0, 100, axis=(0, 1)) File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\cellsparse_api\main.py", line 30, in decode_image return np.array(Image.open(io.BytesIO(base64.b64decode(b64data)))) File "C:\Users\Pierre.HENER\anaconda3\envs\cellsparse-api\lib\site-packages\PIL\Image.py", line 3298, in open raise UnidentifiedImageError(msg) PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x000001FE10E2EE80>

Thank you!

ksugar commented 1 year ago

I think the error is the same one shown below.

Thank you @FabianaMoresi, for reporting the issue! It seems that the error happened when it tried to decode the image. If you use an image with multi-channels, this error may happen. I will work on solving it as soon as possible and will let you know once it's done. For the moment, only grayscale images will work properly. If you want to test how it works, please try it with the grayscale images.

Originally posted by @ksugar in https://github.com/ksugar/cellsparse-api/issues/2#issuecomment-1601118330

I will work on solving it. Thanks.