Remove progress animation on streaming (#6709)

* changes

* add changeset

* changes

* chagnes

---------

Co-authored-by: Ali Abid <ubuntu@ip-172-31-25-241.us-west-2.compute.internal>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
aliabid94 2023-12-12 16:01:40 -08:00 committed by GitHub
parent d76bcaaaf0
commit 6a9151d5c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 10 deletions

View File

@ -0,0 +1,7 @@
---
"@gradio/image": patch
"@gradio/upload": patch
"gradio": patch
---
fix:Remove progress animation on streaming

View File

@ -810,7 +810,7 @@ class Blocks(BlockContext, BlocksEvents, metaclass=BlocksMeta):
preprocess: bool = True, preprocess: bool = True,
postprocess: bool = True, postprocess: bool = True,
scroll_to_output: bool = False, scroll_to_output: bool = False,
show_progress: Literal["full", "minimal", "hidden"] | None = "full", show_progress: Literal["full", "minimal", "hidden"] = "full",
api_name: str | None | Literal[False] = None, api_name: str | None | Literal[False] = None,
js: str | None = None, js: str | None = None,
no_target: bool = False, no_target: bool = False,

View File

@ -138,7 +138,7 @@ class EventListener(str):
event_name: str, event_name: str,
has_trigger: bool = True, has_trigger: bool = True,
config_data: Callable[..., dict[str, Any]] = lambda: {}, config_data: Callable[..., dict[str, Any]] = lambda: {},
show_progress: Literal["full", "minimal", "hidden"] | None = None, show_progress: Literal["full", "minimal", "hidden"] = "full",
callback: Callable | None = None, callback: Callable | None = None,
trigger_after: int | None = None, trigger_after: int | None = None,
trigger_only_on_success: bool = False, trigger_only_on_success: bool = False,
@ -185,7 +185,7 @@ class EventListener(str):
def _setup( def _setup(
_event_name: str, _event_name: str,
_has_trigger: bool, _has_trigger: bool,
_show_progress: Literal["full", "minimal", "hidden"] | None, _show_progress: Literal["full", "minimal", "hidden"],
_callback: Callable | None, _callback: Callable | None,
_trigger_after: int | None, _trigger_after: int | None,
_trigger_only_on_success: bool, _trigger_only_on_success: bool,
@ -197,7 +197,7 @@ class EventListener(str):
outputs: Component | list[Component] | None = None, outputs: Component | list[Component] | None = None,
api_name: str | None | Literal[False] = None, api_name: str | None | Literal[False] = None,
scroll_to_output: bool = False, scroll_to_output: bool = False,
show_progress: Literal["full", "minimal", "hidden"] = "full", show_progress: Literal["full", "minimal", "hidden"] = _show_progress,
queue: bool | None = None, queue: bool | None = None,
batch: bool = False, batch: bool = False,
max_batch_size: int = 4, max_batch_size: int = 4,
@ -305,9 +305,7 @@ class EventListener(str):
preprocess=preprocess, preprocess=preprocess,
postprocess=postprocess, postprocess=postprocess,
scroll_to_output=scroll_to_output, scroll_to_output=scroll_to_output,
show_progress=show_progress show_progress=show_progress,
if show_progress is not None
else _show_progress,
api_name=api_name, api_name=api_name,
js=js, js=js,
concurrency_limit=concurrency_limit, concurrency_limit=concurrency_limit,

View File

@ -55,7 +55,8 @@
pending = false; pending = false;
} }
$: if (uploading) value = null; $: active_streaming = streaming && active_tool === "webcam";
$: if (uploading && !active_streaming) value = null;
$: value && !value.url && (value = normalise_file(value, root, null)); $: value && !value.url && (value = normalise_file(value, root, null));
@ -144,7 +145,7 @@
<BlockLabel {show_label} Icon={ImageIcon} label={label || "Image"} /> <BlockLabel {show_label} Icon={ImageIcon} label={label || "Image"} />
<div data-testid="image" class="image-container"> <div data-testid="image" class="image-container">
{#if value?.url} {#if value?.url && !active_streaming}
<ClearImage <ClearImage
on:remove_image={() => { on:remove_image={() => {
value = null; value = null;

View File

@ -108,7 +108,9 @@
</script> </script>
{#if uploading} {#if uploading}
<UploadProgress {root} {upload_id} files={file_data} /> {#if !hidden}
<UploadProgress {root} {upload_id} files={file_data} />
{/if}
{:else} {:else}
<button <button
class:hidden class:hidden