Upload folder using huggingface_hub
Browse files
6.2.0/image/Index.svelte
CHANGED
|
@@ -119,6 +119,9 @@
|
|
| 119 |
selectable={gradio.props._selectable}
|
| 120 |
i18n={gradio.i18n}
|
| 121 |
buttons={gradio.props.buttons}
|
|
|
|
|
|
|
|
|
|
| 122 |
/>
|
| 123 |
</Block>
|
| 124 |
{:else}
|
|
@@ -162,7 +165,9 @@
|
|
| 162 |
{fullscreen}
|
| 163 |
show_fullscreen_button={gradio.props.buttons === null
|
| 164 |
? true
|
| 165 |
-
: gradio.props.buttons.
|
|
|
|
|
|
|
| 166 |
on:edit={() => gradio.dispatch("edit")}
|
| 167 |
on:clear={() => {
|
| 168 |
fullscreen = false;
|
|
|
|
| 119 |
selectable={gradio.props._selectable}
|
| 120 |
i18n={gradio.i18n}
|
| 121 |
buttons={gradio.props.buttons}
|
| 122 |
+
on_custom_button_click={(id) => {
|
| 123 |
+
gradio.dispatch("custom_button_click", { id });
|
| 124 |
+
}}
|
| 125 |
/>
|
| 126 |
</Block>
|
| 127 |
{:else}
|
|
|
|
| 165 |
{fullscreen}
|
| 166 |
show_fullscreen_button={gradio.props.buttons === null
|
| 167 |
? true
|
| 168 |
+
: gradio.props.buttons.some(
|
| 169 |
+
(btn) => typeof btn === "string" && btn === "fullscreen"
|
| 170 |
+
)}
|
| 171 |
on:edit={() => gradio.dispatch("edit")}
|
| 172 |
on:clear={() => {
|
| 173 |
fullscreen = false;
|
6.2.0/image/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "@gradio/image",
|
| 3 |
-
"version": "0.
|
| 4 |
"description": "Gradio UI packages",
|
| 5 |
"type": "module",
|
| 6 |
"author": "",
|
|
|
|
| 1 |
{
|
| 2 |
"name": "@gradio/image",
|
| 3 |
+
"version": "0.25.0",
|
| 4 |
"description": "Gradio UI packages",
|
| 5 |
"type": "module",
|
| 6 |
"author": "",
|
6.2.0/image/shared/ImagePreview.svelte
CHANGED
|
@@ -11,6 +11,7 @@
|
|
| 11 |
FullscreenButton,
|
| 12 |
DownloadLink
|
| 13 |
} from "@gradio/atoms";
|
|
|
|
| 14 |
import { Download, Image as ImageIcon } from "@gradio/icons";
|
| 15 |
import { get_coordinates_of_clicked_image } from "./utils";
|
| 16 |
import Image from "./Image.svelte";
|
|
@@ -21,7 +22,8 @@
|
|
| 21 |
export let value: null | FileData;
|
| 22 |
export let label: string | undefined = undefined;
|
| 23 |
export let show_label: boolean;
|
| 24 |
-
export let buttons: string[] | null = null;
|
|
|
|
| 25 |
export let selectable = false;
|
| 26 |
export let i18n: I18nFormatter;
|
| 27 |
export let display_icon_button_wrapper_top_corner = false;
|
|
@@ -42,6 +44,11 @@
|
|
| 42 |
};
|
| 43 |
|
| 44 |
let image_container: HTMLElement;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
</script>
|
| 46 |
|
| 47 |
<BlockLabel
|
|
@@ -56,17 +63,18 @@
|
|
| 56 |
<IconButtonWrapper
|
| 57 |
display_top_corner={display_icon_button_wrapper_top_corner}
|
| 58 |
show_background={show_button_background}
|
|
|
|
|
|
|
| 59 |
>
|
| 60 |
-
{#if
|
| 61 |
<FullscreenButton {fullscreen} on:fullscreen />
|
| 62 |
{/if}
|
| 63 |
-
|
| 64 |
-
{#if buttons === null ? true : buttons.includes("download")}
|
| 65 |
<DownloadLink href={value.url} download={value.orig_name || "image"}>
|
| 66 |
<IconButton Icon={Download} label={i18n("common.download")} />
|
| 67 |
</DownloadLink>
|
| 68 |
{/if}
|
| 69 |
-
{#if
|
| 70 |
<ShareButton
|
| 71 |
{i18n}
|
| 72 |
on:share
|
|
|
|
| 11 |
FullscreenButton,
|
| 12 |
DownloadLink
|
| 13 |
} from "@gradio/atoms";
|
| 14 |
+
import type { CustomButton as CustomButtonType } from "@gradio/utils";
|
| 15 |
import { Download, Image as ImageIcon } from "@gradio/icons";
|
| 16 |
import { get_coordinates_of_clicked_image } from "./utils";
|
| 17 |
import Image from "./Image.svelte";
|
|
|
|
| 22 |
export let value: null | FileData;
|
| 23 |
export let label: string | undefined = undefined;
|
| 24 |
export let show_label: boolean;
|
| 25 |
+
export let buttons: (string | CustomButtonType)[] | null = null;
|
| 26 |
+
export let on_custom_button_click: ((id: number) => void) | null = null;
|
| 27 |
export let selectable = false;
|
| 28 |
export let i18n: I18nFormatter;
|
| 29 |
export let display_icon_button_wrapper_top_corner = false;
|
|
|
|
| 44 |
};
|
| 45 |
|
| 46 |
let image_container: HTMLElement;
|
| 47 |
+
|
| 48 |
+
$: buttons_to_render =
|
| 49 |
+
buttons && buttons.length > 0
|
| 50 |
+
? buttons
|
| 51 |
+
: ["download", "share", "fullscreen"];
|
| 52 |
</script>
|
| 53 |
|
| 54 |
<BlockLabel
|
|
|
|
| 63 |
<IconButtonWrapper
|
| 64 |
display_top_corner={display_icon_button_wrapper_top_corner}
|
| 65 |
show_background={show_button_background}
|
| 66 |
+
buttons={buttons_to_render}
|
| 67 |
+
{on_custom_button_click}
|
| 68 |
>
|
| 69 |
+
{#if buttons_to_render.some((btn) => typeof btn === "string" && btn === "fullscreen")}
|
| 70 |
<FullscreenButton {fullscreen} on:fullscreen />
|
| 71 |
{/if}
|
| 72 |
+
{#if buttons_to_render.some((btn) => typeof btn === "string" && btn === "download")}
|
|
|
|
| 73 |
<DownloadLink href={value.url} download={value.orig_name || "image"}>
|
| 74 |
<IconButton Icon={Download} label={i18n("common.download")} />
|
| 75 |
</DownloadLink>
|
| 76 |
{/if}
|
| 77 |
+
{#if buttons_to_render.some((btn) => typeof btn === "string" && btn === "share")}
|
| 78 |
<ShareButton
|
| 79 |
{i18n}
|
| 80 |
on:share
|
6.2.0/image/shared/types.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import type { LoadingStatus } from "@gradio/statustracker";
|
| 2 |
import type { FileData } from "@gradio/client";
|
|
|
|
| 3 |
|
| 4 |
export interface Base64File {
|
| 5 |
url: string;
|
|
@@ -18,7 +19,7 @@ export interface ImageProps {
|
|
| 18 |
width: number;
|
| 19 |
webcam_options: WebcamOptions;
|
| 20 |
value: FileData | null;
|
| 21 |
-
buttons: string[];
|
| 22 |
pending: boolean;
|
| 23 |
streaming: boolean;
|
| 24 |
stream_every: number;
|
|
@@ -39,4 +40,5 @@ export interface ImageEvents {
|
|
| 39 |
error: any;
|
| 40 |
close_stream: void;
|
| 41 |
edit: void;
|
|
|
|
| 42 |
}
|
|
|
|
| 1 |
import type { LoadingStatus } from "@gradio/statustracker";
|
| 2 |
import type { FileData } from "@gradio/client";
|
| 3 |
+
import type { CustomButton } from "@gradio/utils";
|
| 4 |
|
| 5 |
export interface Base64File {
|
| 6 |
url: string;
|
|
|
|
| 19 |
width: number;
|
| 20 |
webcam_options: WebcamOptions;
|
| 21 |
value: FileData | null;
|
| 22 |
+
buttons: (string | CustomButton)[];
|
| 23 |
pending: boolean;
|
| 24 |
streaming: boolean;
|
| 25 |
stream_every: number;
|
|
|
|
| 40 |
error: any;
|
| 41 |
close_stream: void;
|
| 42 |
edit: void;
|
| 43 |
+
custom_button_click: { id: number };
|
| 44 |
}
|