@gradio/image 0.6.0 → 0.6.1

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @gradio/image
2
2
 
3
+ ## 0.6.1
4
+
5
+ ### Fixes
6
+
7
+ - [#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)!
8
+ - [#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)!
9
+
3
10
  ## 0.6.0
4
11
 
5
12
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/image",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -12,18 +12,18 @@
12
12
  "resize-observer-polyfill": "^1.5.1",
13
13
  "@gradio/atoms": "^0.4.1",
14
14
  "@gradio/client": "^0.10.0",
15
+ "@gradio/icons": "^0.3.2",
16
+ "@gradio/upload": "^0.6.0",
15
17
  "@gradio/utils": "^0.2.0",
16
- "@gradio/upload": "^0.5.8",
17
18
  "@gradio/statustracker": "^0.4.3",
18
- "@gradio/wasm": "^0.4.1",
19
- "@gradio/icons": "^0.3.2"
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
  }
@@ -124,6 +124,7 @@
124
124
  </Upload>
125
125
  {#if active_source === "webcam" && (streaming || (!streaming && !value))}
126
126
  <Webcam
127
+ {root}
127
128
  on:capture={(e) => handle_save(e.detail)}
128
129
  on:stream={(e) => handle_save(e.detail)}
129
130
  on:error
@@ -1,12 +1,15 @@
1
1
  <script lang="ts">
2
- import { createEventDispatcher, onMount, tick } from "svelte";
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
- dispatch("capture", {
94
- //@ts-ignore
95
- data: e.target.result,
96
- name: "sample." + mimeType.substring(6),
97
- is_example: false,
98
- is_file: false
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
  };