Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: Exception in ASGI application when input image streaming = True #8249

Open
1 task done
radellng opened this issue May 9, 2024 · 1 comment
Open
1 task done
Labels
bug Something isn't working

Comments

@radellng
Copy link

radellng commented May 9, 2024

Describe the bug

Streaming live webcam feature works perfectly in Local Host but unable to work the same in live url.
I am not using Google Colab. And have also enabled allowed paths based on other similar issues.
I have created a new virtual environment to ensure there are no clashed dependencies.
Also, I have followed the minimal template that was supposed to be working but it did not.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr

def function(im):
    return im

with gr.Blocks() as demo:
    with gr.Row():
        input_img = gr.Image(sources=["webcam"])
        output_img = gr.Image()
        input_img.stream(function, input_img, output_img)
demo.launch(share=True, debug=True, allowed_paths=["."])

if __name__ == "__main__":
    demo.launch()

Screenshot

Untitled

this error keeps popping up when I webcam is starting to stream.

Logs

ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\uvicorn\protocols\http\httptools_impl.py", line 411, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 69, in __call__
    return await self.app(scope, receive, send)
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\fastapi\applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\starlette\applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\starlette\middleware\errors.py", line 186, in __call__
    raise exc
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\starlette\middleware\errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\gradio\route_utils.py", line 713, in __call__
    await self.simple_response(scope, receive, send, request_headers=headers)
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\gradio\route_utils.py", line 729, in simple_response
    await self.app(scope, receive, send)
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\starlette\middleware\exceptions.py", line 65, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\starlette\_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\starlette\routing.py", line 756, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\starlette\routing.py", line 776, in app
    await route.handle(scope, receive, send)
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\starlette\routing.py", line 297, in handle
    await self.app(scope, receive, send)
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\starlette\routing.py", line 77, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\starlette\_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\starlette\routing.py", line 72, in app
    response = await func(request)
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\fastapi\routing.py", line 278, in app
    raw_response = await run_endpoint_function(
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\fastapi\routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\gradio\routes.py", line 1085, in upload_file
    form = await multipart_parser.parse()
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\gradio\route_utils.py", line 597, in parse
    async for chunk in self.stream:
  File "C:\Users\radel\anaconda3\envs\gradio\lib\site-packages\starlette\requests.py", line 238, in stream
    raise ClientDisconnect()
starlette.requests.ClientDisconnect

System Info

Gradio Environment Information:
------------------------------
Operating System: Windows
gradio version: 4.29.0
gradio_client version: 0.16.1

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
altair: 5.3.0
fastapi: 0.111.0
ffmpy: 0.3.2
gradio-client==0.16.1 is not installed.
httpx: 0.27.0
huggingface-hub: 0.23.0
importlib-resources: 6.4.0
jinja2: 3.1.4
markupsafe: 2.1.5
matplotlib: 3.8.4
numpy: 1.26.4
orjson: 3.10.3
packaging: 24.0
pandas: 2.2.2
pillow: 10.3.0
pydantic: 2.7.1
pydub: 0.25.1
python-multipart: 0.0.9
pyyaml: 6.0.1
ruff: 0.4.3
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.12.3
typing-extensions: 4.11.0
urllib3: 2.2.1
uvicorn: 0.29.0
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.


gradio_client dependencies in your environment:

fsspec: 2024.3.1
httpx: 0.27.0
huggingface-hub: 0.23.0
packaging: 24.0
typing-extensions: 4.11.0
websockets: 11.0.3

Severity

Blocking usage of gradio

@radellng radellng added the bug Something isn't working label May 9, 2024
@radellng radellng changed the title ERROR: Exception in ASGI application when input image streaming = True, ERROR: Exception in ASGI application when input image streaming = True May 9, 2024
@radellng
Copy link
Author

radellng commented May 9, 2024

Also, tried to access with iOS device and it allowed me to select "Back Camera" function but it throws the same Starlette Client Disconnect error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant