Skip to content

The way to start or stop the Image component for wabcam streaming #1323

@JefferyChiang

Description

@JefferyChiang
  • I have searched to see if a similar issue already exists.

Is your feature request related to a problem? Please describe.

related to #220
I tried the Image streaming function for webcam, and it can performed real time inference correctly.
I'm wondering is there a proper way to trigger start or stop the real time inference?

Describe the solution you'd like

Though I can use another Tab to stop the inference thread, I think it will be more easy to have a button to trigger.

Additional context
Here is my code for testing the Image stream function.

import gradio as gr

def image_mod(image):
    return image.rotate(45)
    
block = gr.Blocks()
with block:
    with gr.Tabs():
        with gr.TabItem("Train"):
            train = gr.Button("Train")
        with gr.TabItem("Inference"):
            with gr.Row():
                input_image = gr.Image(type='pil',label="Input Image", source="webcam",
                                 streaming=True)
                output_image = gr.Image(label="Output Image")
                input_image.change(image_mod,
                           inputs=input_image,
                           outputs=output_image)
block.launch(show_error=True, inbrowser=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsvelteFrontend-related issue (JS)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions