Upload folder using huggingface_hub
Browse files
6.4.0/image/Index.svelte
CHANGED
|
@@ -185,7 +185,7 @@
|
|
| 185 |
}}
|
| 186 |
on:select={({ detail }) => gradio.dispatch("select", detail)}
|
| 187 |
on:share={({ detail }) => gradio.dispatch("share", detail)}
|
| 188 |
-
|
| 189 |
gradio.shared.loading_status.status = "error";
|
| 190 |
gradio.dispatch("error", detail);
|
| 191 |
}}
|
|
|
|
| 185 |
}}
|
| 186 |
on:select={({ detail }) => gradio.dispatch("select", detail)}
|
| 187 |
on:share={({ detail }) => gradio.dispatch("share", detail)}
|
| 188 |
+
onerror={(detail) => {
|
| 189 |
gradio.shared.loading_status.status = "error";
|
| 190 |
gradio.dispatch("error", detail);
|
| 191 |
}}
|
6.4.0/image/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"name": "@gradio/image",
|
| 3 |
-
"version": "0.25.
|
| 4 |
"description": "Gradio UI packages",
|
| 5 |
"type": "module",
|
| 6 |
"author": "",
|
|
|
|
| 1 |
{
|
| 2 |
"name": "@gradio/image",
|
| 3 |
+
"version": "0.25.1",
|
| 4 |
"description": "Gradio UI packages",
|
| 5 |
"type": "module",
|
| 6 |
"author": "",
|
6.4.0/image/shared/ImageUploader.svelte
CHANGED
|
@@ -38,6 +38,7 @@
|
|
| 38 |
export let show_fullscreen_button = true;
|
| 39 |
export let stream_state: "open" | "waiting" | "closed" = "closed";
|
| 40 |
export let upload_promise: Promise<any> | null = null;
|
|
|
|
| 41 |
|
| 42 |
let upload_input: Upload;
|
| 43 |
export let uploading = false;
|
|
@@ -47,9 +48,7 @@
|
|
| 47 |
let files: FileData[] = [];
|
| 48 |
let upload_id: string;
|
| 49 |
|
| 50 |
-
async function handle_upload({
|
| 51 |
-
detail
|
| 52 |
-
}: CustomEvent<FileData>): Promise<void> {
|
| 53 |
if (!streaming) {
|
| 54 |
if (detail.path?.toLowerCase().endsWith(".svg") && detail.url) {
|
| 55 |
const response = await fetch(detail.url);
|
|
@@ -190,7 +189,7 @@
|
|
| 190 |
<IconButton
|
| 191 |
Icon={Clear}
|
| 192 |
label="Remove Image"
|
| 193 |
-
|
| 194 |
/>
|
| 195 |
{/if}
|
| 196 |
</IconButtonWrapper>
|
|
@@ -209,8 +208,8 @@
|
|
| 209 |
bind:uploading
|
| 210 |
bind:dragging
|
| 211 |
filetype={active_source === "clipboard" ? "clipboard" : "image/*"}
|
| 212 |
-
|
| 213 |
-
|
| 214 |
{root}
|
| 215 |
{max_file_size}
|
| 216 |
disable_click={!sources.includes("upload") || value !== null}
|
|
|
|
| 38 |
export let show_fullscreen_button = true;
|
| 39 |
export let stream_state: "open" | "waiting" | "closed" = "closed";
|
| 40 |
export let upload_promise: Promise<any> | null = null;
|
| 41 |
+
export let onerror: ((error: string) => void) | undefined = undefined;
|
| 42 |
|
| 43 |
let upload_input: Upload;
|
| 44 |
export let uploading = false;
|
|
|
|
| 48 |
let files: FileData[] = [];
|
| 49 |
let upload_id: string;
|
| 50 |
|
| 51 |
+
async function handle_upload(detail: FileData): Promise<void> {
|
|
|
|
|
|
|
| 52 |
if (!streaming) {
|
| 53 |
if (detail.path?.toLowerCase().endsWith(".svg") && detail.url) {
|
| 54 |
const response = await fetch(detail.url);
|
|
|
|
| 189 |
<IconButton
|
| 190 |
Icon={Clear}
|
| 191 |
label="Remove Image"
|
| 192 |
+
onclick={handle_remove_image_click}
|
| 193 |
/>
|
| 194 |
{/if}
|
| 195 |
</IconButtonWrapper>
|
|
|
|
| 208 |
bind:uploading
|
| 209 |
bind:dragging
|
| 210 |
filetype={active_source === "clipboard" ? "clipboard" : "image/*"}
|
| 211 |
+
onload={handle_upload}
|
| 212 |
+
{onerror}
|
| 213 |
{root}
|
| 214 |
{max_file_size}
|
| 215 |
disable_click={!sources.includes("upload") || value !== null}
|