@gradio/image 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -2
- package/Index.svelte +7 -2
- package/package.json +8 -8
- package/shared/ImagePreview.svelte +1 -1
- package/shared/ImageUploader.svelte +13 -1
package/CHANGELOG.md
CHANGED
@@ -1,14 +1,29 @@
|
|
1
1
|
# @gradio/image
|
2
2
|
|
3
|
+
## 0.3.6
|
4
|
+
|
5
|
+
### Fixes
|
6
|
+
|
7
|
+
- [#6441](https://github.com/gradio-app/gradio/pull/6441) [`2f805a7dd`](https://github.com/gradio-app/gradio/commit/2f805a7dd3d2b64b098f659dadd5d01258290521) - Small but important bugfixes for gr.Image: The upload event was not triggering at all. The paste-from-clipboard was not triggering an upload event. The clear button was not triggering a change event. The change event was triggering infinitely. Uploaded images were not preserving their original names. Uploading a new image should clear out the previous image. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
|
8
|
+
|
9
|
+
## 0.3.5
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- Updated dependencies [[`324867f63`](https://github.com/gradio-app/gradio/commit/324867f63c920113d89a565892aa596cf8b1e486), [`d84209703`](https://github.com/gradio-app/gradio/commit/d84209703b7a0728cdb49221e543500ddb6a8d33)]:
|
14
|
+
- @gradio/client@0.8.1
|
15
|
+
- @gradio/wasm@0.3.0
|
16
|
+
- @gradio/upload@0.4.1
|
17
|
+
|
3
18
|
## 0.3.4
|
4
19
|
|
5
20
|
### Features
|
6
21
|
|
7
|
-
- [#6363](https://github.com/gradio-app/gradio/pull/6363) [`4d3aad33a`](https://github.com/gradio-app/gradio/commit/4d3aad33a0b66639dbbb2928f305a79fb7789b2d) - Fix image upload.
|
22
|
+
- [#6363](https://github.com/gradio-app/gradio/pull/6363) [`4d3aad33a`](https://github.com/gradio-app/gradio/commit/4d3aad33a0b66639dbbb2928f305a79fb7789b2d) - Fix image upload. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
|
8
23
|
|
9
24
|
### Fixes
|
10
25
|
|
11
|
-
- [#6322](https://github.com/gradio-app/gradio/pull/6322) [`6204ccac5`](https://github.com/gradio-app/gradio/commit/6204ccac5967763e0ebde550d04d12584243a120) - Fixes `gr.load()` so it works properly with Images and Examples.
|
26
|
+
- [#6322](https://github.com/gradio-app/gradio/pull/6322) [`6204ccac5`](https://github.com/gradio-app/gradio/commit/6204ccac5967763e0ebde550d04d12584243a120) - Fixes `gr.load()` so it works properly with Images and Examples. Thanks [@abidlabs](https://github.com/abidlabs)!
|
12
27
|
|
13
28
|
## 0.3.3
|
14
29
|
|
package/Index.svelte
CHANGED
@@ -61,7 +61,9 @@
|
|
61
61
|
share: ShareData;
|
62
62
|
}>;
|
63
63
|
|
64
|
-
$:
|
64
|
+
$: url = _value?.url;
|
65
|
+
$: url && gradio.dispatch("change");
|
66
|
+
|
65
67
|
let dragging: boolean;
|
66
68
|
let active_tool: null | "webcam" = null;
|
67
69
|
</script>
|
@@ -127,7 +129,10 @@
|
|
127
129
|
{root}
|
128
130
|
{sources}
|
129
131
|
on:edit={() => gradio.dispatch("edit")}
|
130
|
-
on:clear={() =>
|
132
|
+
on:clear={() => {
|
133
|
+
gradio.dispatch("clear");
|
134
|
+
gradio.dispatch("change");
|
135
|
+
}}
|
131
136
|
on:stream={() => gradio.dispatch("stream")}
|
132
137
|
on:drag={({ detail }) => (dragging = detail)}
|
133
138
|
on:upload={() => gradio.dispatch("upload")}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gradio/image",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.6",
|
4
4
|
"description": "Gradio UI packages",
|
5
5
|
"type": "module",
|
6
6
|
"author": "",
|
@@ -10,13 +10,13 @@
|
|
10
10
|
"cropperjs": "^1.5.12",
|
11
11
|
"lazy-brush": "^1.0.1",
|
12
12
|
"resize-observer-polyfill": "^1.5.1",
|
13
|
-
"@gradio/atoms": "^0.2.
|
14
|
-
"@gradio/client": "^0.8.
|
15
|
-
"@gradio/
|
16
|
-
"@gradio/
|
17
|
-
"@gradio/
|
18
|
-
"@gradio/
|
19
|
-
"@gradio/
|
13
|
+
"@gradio/atoms": "^0.2.2",
|
14
|
+
"@gradio/client": "^0.8.1",
|
15
|
+
"@gradio/statustracker": "^0.3.2",
|
16
|
+
"@gradio/upload": "^0.4.2",
|
17
|
+
"@gradio/icons": "^0.2.1",
|
18
|
+
"@gradio/wasm": "^0.3.0",
|
19
|
+
"@gradio/utils": "^0.2.0"
|
20
20
|
},
|
21
21
|
"main_changeset": true,
|
22
22
|
"main": "./Index.svelte",
|
@@ -33,10 +33,12 @@
|
|
33
33
|
export let i18n: I18nFormatter;
|
34
34
|
|
35
35
|
let upload: Upload;
|
36
|
+
let uploading = false;
|
36
37
|
export let active_tool: "webcam" | null = null;
|
37
38
|
|
38
39
|
function handle_upload({ detail }: CustomEvent<FileData>): void {
|
39
40
|
value = normalise_file(detail, root, null);
|
41
|
+
dispatch("upload");
|
40
42
|
}
|
41
43
|
|
42
44
|
async function handle_save(img_blob: Blob | any): Promise<void> {
|
@@ -52,6 +54,8 @@
|
|
52
54
|
pending = false;
|
53
55
|
}
|
54
56
|
|
57
|
+
$: if (uploading) value = null;
|
58
|
+
|
55
59
|
$: value && !value.url && (value = normalise_file(value, root, null));
|
56
60
|
|
57
61
|
const dispatch = createEventDispatcher<{
|
@@ -111,6 +115,7 @@
|
|
111
115
|
for (let i = 0; i < items.length; i++) {
|
112
116
|
const type = items[i].types.find((t) => t.startsWith("image/"));
|
113
117
|
if (type) {
|
118
|
+
value = null;
|
114
119
|
items[i].getType(type).then(async (blob) => {
|
115
120
|
const f = await upload.load_files([
|
116
121
|
new File([blob], `clipboard.${type.replace("image/", "")}`)
|
@@ -139,12 +144,18 @@
|
|
139
144
|
|
140
145
|
<div data-testid="image" class="image-container">
|
141
146
|
{#if value?.url}
|
142
|
-
<ClearImage
|
147
|
+
<ClearImage
|
148
|
+
on:remove_image={() => {
|
149
|
+
value = null;
|
150
|
+
dispatch("clear");
|
151
|
+
}}
|
152
|
+
/>
|
143
153
|
{/if}
|
144
154
|
<div class="upload-container">
|
145
155
|
<Upload
|
146
156
|
hidden={value !== null || active_tool === "webcam"}
|
147
157
|
bind:this={upload}
|
158
|
+
bind:uploading
|
148
159
|
bind:dragging
|
149
160
|
filetype="image/*"
|
150
161
|
on:load={handle_upload}
|
@@ -187,6 +198,7 @@
|
|
187
198
|
on:click={() => handle_toolbar(source)}
|
188
199
|
Icon={sources_meta[source].icon}
|
189
200
|
size="large"
|
201
|
+
label="{source}-image-toolbar-btn"
|
190
202
|
padded={false}
|
191
203
|
/>
|
192
204
|
{/each}
|