Fix webcam when streaming=True (#6865)

* show webcam when streaming value is true

* add story

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
Hannah 2023-12-21 18:50:11 +00:00 committed by GitHub
parent e974cf045c
commit 15c97c6d34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 1 deletions

View File

@ -0,0 +1,6 @@
---
"@gradio/image": patch
"gradio": patch
---
fix:Fix webcam when `streaming=True`

View File

@ -84,3 +84,18 @@
interactive: true
}}
/>
<Story
name="interactive webcam with streaming"
args={{
sources: ["webcam"],
show_download_button: true,
interactive: true,
value: {
path: "https://gradio-builds.s3.amazonaws.com/demo-files/ghepardo-primo-piano.jpg",
url: "https://gradio-builds.s3.amazonaws.com/demo-files/ghepardo-primo-piano.jpg",
orig_name: "cheetah.jpg"
},
streaming: true
}}
/>

View File

@ -122,7 +122,7 @@
<slot />
{/if}
</Upload>
{#if active_source === "webcam" && !value}
{#if active_source === "webcam" && (streaming || (!streaming && !value))}
<Webcam
on:capture={(e) => handle_save(e.detail)}
on:stream={(e) => handle_save(e.detail)}