@gradio/image 0.6.0 → 0.7.0
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 +13 -0
- package/Example.svelte +3 -2
- package/package.json +7 -7
- package/shared/ImageUploader.svelte +1 -0
- package/shared/Webcam.svelte +15 -10
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# @gradio/image
|
2
2
|
|
3
|
+
## 0.7.0
|
4
|
+
|
5
|
+
### Fixes
|
6
|
+
|
7
|
+
- [#6933](https://github.com/gradio-app/gradio/pull/6933) [`9cefd2e`](https://github.com/gradio-app/gradio/commit/9cefd2e90a1d0cc4d3e4e953fc5b9b1a7afb68dd) - Refactor examples so they accept data in the same format as is returned by function, rename `.as_example()` to `.process_example()`. Thanks [@abidlabs](https://github.com/abidlabs)!
|
8
|
+
|
9
|
+
## 0.6.1
|
10
|
+
|
11
|
+
### Fixes
|
12
|
+
|
13
|
+
- [#6885](https://github.com/gradio-app/gradio/pull/6885) [`640b7fe`](https://github.com/gradio-app/gradio/commit/640b7fe05276e11720b4341cadf088491395e53d) - Fix issue with Webcam Recording. Thanks [@dawoodkhan82](https://github.com/dawoodkhan82)!
|
14
|
+
- [#6967](https://github.com/gradio-app/gradio/pull/6967) [`5e00162`](https://github.com/gradio-app/gradio/commit/5e0016267f1d683e2daab82ee4a33d2f09513a34) - Make <Gallery /> Wasm-compatible. Thanks [@whitphx](https://github.com/whitphx)!
|
15
|
+
|
3
16
|
## 0.6.0
|
4
17
|
|
5
18
|
### Features
|
package/Example.svelte
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
<script lang="ts">
|
2
2
|
import Image from "./shared/Image.svelte";
|
3
|
+
import type { FileData } from "@gradio/client";
|
3
4
|
|
4
|
-
export let value:
|
5
|
+
export let value: null | FileData;
|
5
6
|
export let samples_dir: string;
|
6
7
|
export let type: "gallery" | "table";
|
7
8
|
export let selected = false;
|
@@ -13,7 +14,7 @@
|
|
13
14
|
class:gallery={type === "gallery"}
|
14
15
|
class:selected
|
15
16
|
>
|
16
|
-
<Image src={samples_dir + value} alt="" />
|
17
|
+
<Image src={samples_dir + value?.path} alt="" />
|
17
18
|
</div>
|
18
19
|
|
19
20
|
<style>
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gradio/image",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.7.0",
|
4
4
|
"description": "Gradio UI packages",
|
5
5
|
"type": "module",
|
6
6
|
"author": "",
|
@@ -11,19 +11,19 @@
|
|
11
11
|
"lazy-brush": "^1.0.1",
|
12
12
|
"resize-observer-polyfill": "^1.5.1",
|
13
13
|
"@gradio/atoms": "^0.4.1",
|
14
|
-
"@gradio/client": "^0.10.
|
15
|
-
"@gradio/
|
16
|
-
"@gradio/upload": "^0.5.8",
|
14
|
+
"@gradio/client": "^0.10.1",
|
15
|
+
"@gradio/icons": "^0.3.2",
|
17
16
|
"@gradio/statustracker": "^0.4.3",
|
18
|
-
"@gradio/
|
19
|
-
"@gradio/
|
17
|
+
"@gradio/upload": "^0.6.1",
|
18
|
+
"@gradio/utils": "^0.2.0",
|
19
|
+
"@gradio/wasm": "^0.5.0"
|
20
20
|
},
|
21
21
|
"main_changeset": true,
|
22
22
|
"main": "./Index.svelte",
|
23
23
|
"exports": {
|
24
24
|
".": "./Index.svelte",
|
25
|
-
"./example": "./Example.svelte",
|
26
25
|
"./shared": "./shared/index.ts",
|
26
|
+
"./example": "./Example.svelte",
|
27
27
|
"./package.json": "./package.json"
|
28
28
|
}
|
29
29
|
}
|
package/shared/Webcam.svelte
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
<script lang="ts">
|
2
|
-
import { createEventDispatcher, onMount
|
2
|
+
import { createEventDispatcher, onMount } from "svelte";
|
3
3
|
import { Camera, Circle, Square, DropdownArrow } from "@gradio/icons";
|
4
4
|
import type { I18nFormatter } from "@gradio/utils";
|
5
|
+
import type { FileData } from "@gradio/client";
|
6
|
+
import { prepare_files, upload } from "@gradio/client";
|
5
7
|
|
6
8
|
let video_source: HTMLVideoElement;
|
7
9
|
let canvas: HTMLCanvasElement;
|
8
10
|
export let streaming = false;
|
9
11
|
export let pending = false;
|
12
|
+
export let root = "";
|
10
13
|
|
11
14
|
export let mode: "image" | "video" = "image";
|
12
15
|
export let mirror_webcam: boolean;
|
@@ -15,7 +18,7 @@
|
|
15
18
|
|
16
19
|
const dispatch = createEventDispatcher<{
|
17
20
|
stream: undefined;
|
18
|
-
capture: Blob;
|
21
|
+
capture: FileData | Blob | null;
|
19
22
|
error: string;
|
20
23
|
start_recording: undefined;
|
21
24
|
stop_recording: undefined;
|
@@ -88,15 +91,17 @@
|
|
88
91
|
media_recorder.stop();
|
89
92
|
let video_blob = new Blob(recorded_blobs, { type: mimeType });
|
90
93
|
let ReaderObj = new FileReader();
|
91
|
-
ReaderObj.onload = function (e): void {
|
94
|
+
ReaderObj.onload = async function (e): Promise<void> {
|
92
95
|
if (e.target) {
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
96
|
+
let _video_blob = new File(
|
97
|
+
[video_blob],
|
98
|
+
"sample." + mimeType.substring(6)
|
99
|
+
);
|
100
|
+
const val = await prepare_files([_video_blob]);
|
101
|
+
let value = (
|
102
|
+
(await upload(val, root))?.filter(Boolean) as FileData[]
|
103
|
+
)[0];
|
104
|
+
dispatch("capture", value);
|
100
105
|
dispatch("stop_recording");
|
101
106
|
}
|
102
107
|
};
|