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

When every set in gr.Button.click, the inner function cannot get live camera images #8463

Closed
1 task done
P2Oileen opened this issue Jun 5, 2024 · 0 comments · Fixed by #8505
Closed
1 task done
Labels
bug Something isn't working

Comments

@P2Oileen
Copy link

P2Oileen commented Jun 5, 2024

Describe the bug

I am trying to show the camera image, but when I set button.click(every=xxx), it cannot get any image. This problem doesn't happen when I delete every=xxx and click the button by myself.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr

def echo(webcam_image):
    if webcam_image is not None:
        gr.Info("webcam_image get")
    else:
        gr.Info("no webcam_image")
    return webcam_image
    
def main():
    with gr.Blocks() as demo:
        webcam = gr.Image(sources=["webcam"], height=300, streaming=True)
        img = gr.Image()
        button = gr.Button("Start!")
        button.click(echo, inputs=[webcam], outputs=[img], every=5)
    demo.launch(server_name="0.0.0.0")
    demo.queue()

if __name__ == "__main__":
    main()

Screenshot

image

Logs

No response

System Info

Gradio Environment Information: 
------------------------------
Operating System: Linux
gradio version: 4.32.2
gradio_client version: 0.17.0

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

aiofiles: 23.2.1
altair: 5.3.0
fastapi: 0.110.2
ffmpy: 0.3.2
gradio-client==0.17.0 is not installed.
httpx: 0.27.0
huggingface-hub: 0.22.2
importlib-resources: 6.4.0
jinja2: 3.0.3
markupsafe: 2.1.2
matplotlib: 3.7.1
numpy: 1.24.4
orjson: 3.10.1
packaging: 23.1
pandas: 2.0.1
pillow: 9.5.0
pydantic: 2.7.1
pydub: 0.25.1
python-multipart: 0.0.9
pyyaml: 5.4.1
ruff: 0.4.1
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.22.2
packaging: 23.1
typing-extensions: 4.11.0
websockets: 11.0.3

Severity

Blocking usage of gradio

@P2Oileen P2Oileen added the bug Something isn't working label Jun 5, 2024
@P2Oileen P2Oileen changed the title When every set in gr.Button.click, the inner function cannot get live camera images When every set in gr.Button.click, the inner function cannot get live camera images Jun 5, 2024
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

Successfully merging a pull request may close this issue.

1 participant