@gradio/video 0.6.12 → 0.8.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 CHANGED
@@ -1,5 +1,70 @@
1
1
  # @gradio/video
2
2
 
3
+ ## 0.8.0
4
+
5
+ ### Features
6
+
7
+ - [#8121](https://github.com/gradio-app/gradio/pull/8121) [`f5b710c`](https://github.com/gradio-app/gradio/commit/f5b710c919b0ce604ea955f0d5f4faa91095ca4a) - chore(deps): update dependency eslint to v9. Thanks @renovate!
8
+ - [#8209](https://github.com/gradio-app/gradio/pull/8209) [`b9afe93`](https://github.com/gradio-app/gradio/commit/b9afe93915401df5bd6737c89395c2477acfa585) - Rename `eventSource_Factory` and `fetch_implementation`. Thanks @hannahblair!
9
+
10
+ ### Fixes
11
+
12
+ - [#8179](https://github.com/gradio-app/gradio/pull/8179) [`6a218b4`](https://github.com/gradio-app/gradio/commit/6a218b4148095aaa0c58d8c20973ba01c8764fc2) - rework upload to be a class method + pass client into each component. Thanks @pngwn!
13
+
14
+ ### Dependency updates
15
+
16
+ - @gradio/atoms@0.7.2
17
+ - @gradio/client@0.18.0
18
+ - @gradio/upload@0.10.0
19
+ - @gradio/utils@0.4.1
20
+ - @gradio/wasm@0.10.1
21
+ - @gradio/statustracker@0.5.1
22
+ - @gradio/image@0.11.0
23
+
24
+ ## 0.7.0
25
+
26
+ ### Highlights
27
+
28
+ #### Setting File Upload Limits ([#7909](https://github.com/gradio-app/gradio/pull/7909) [`2afca65`](https://github.com/gradio-app/gradio/commit/2afca6541912b37dc84f447c7ad4af21607d7c72))
29
+
30
+ We have added a `max_file_size` size parameter to `launch()` that limits to size of files uploaded to the server. This limit applies to each individual file. This parameter can be specified as a string or an integer (corresponding to the size in bytes).
31
+
32
+ The following code snippet sets a max file size of 5 megabytes.
33
+
34
+ ```python
35
+ import gradio as gr
36
+
37
+ demo = gr.Interface(lambda x: x, "image", "image")
38
+
39
+ demo.launch(max_file_size="5mb")
40
+ # or
41
+ demo.launch(max_file_size=5 * gr.FileSize.MB)
42
+ ```
43
+
44
+ ![max_file_size_upload](https://github.com/gradio-app/gradio/assets/41651716/7547330c-a082-4901-a291-3f150a197e45)
45
+
46
+
47
+ #### Error states can now be cleared
48
+
49
+ When a component encounters an error, the error state shown in the UI can now be cleared by clicking on the `x` icon in the top right of the component. This applies to all types of errors, whether it's raised in the UI or the server.
50
+
51
+ ![error_modal_calculator](https://github.com/gradio-app/gradio/assets/41651716/16cb071c-accd-45a6-9c18-0dea27d4bd98)
52
+
53
+ Thanks @freddyaboulton!
54
+
55
+ ### Fixes
56
+
57
+ - [#8066](https://github.com/gradio-app/gradio/pull/8066) [`624f9b9`](https://github.com/gradio-app/gradio/commit/624f9b9477f74a581a6c14119234f9efdfcda398) - make gradio dev tools a local dependency rather than bundling. Thanks @pngwn!
58
+
59
+ ### Dependency updates
60
+
61
+ - @gradio/atoms@0.7.1
62
+ - @gradio/client@0.17.0
63
+ - @gradio/image@0.10.0
64
+ - @gradio/statustracker@0.5.0
65
+ - @gradio/upload@0.9.0
66
+ - @gradio/utils@0.4.0
67
+
3
68
  ## 0.6.12
4
69
 
5
70
  ### Dependency updates
package/Index.svelte CHANGED
@@ -48,6 +48,7 @@
48
48
  share: ShareData;
49
49
  error: string;
50
50
  warning: string;
51
+ clear_status: LoadingStatus;
51
52
  }>;
52
53
  export let interactive: boolean;
53
54
  export let mirror_webcam: boolean;
@@ -137,6 +138,7 @@
137
138
  autoscroll={gradio.autoscroll}
138
139
  i18n={gradio.i18n}
139
140
  {...loading_status}
141
+ on:clear_status={() => gradio.dispatch("clear_status", loading_status)}
140
142
  />
141
143
 
142
144
  <StaticVideo
@@ -154,6 +156,7 @@
154
156
  on:share={({ detail }) => gradio.dispatch("share", detail)}
155
157
  on:error={({ detail }) => gradio.dispatch("error", detail)}
156
158
  i18n={gradio.i18n}
159
+ upload={gradio.client.upload}
157
160
  />
158
161
  </Block>
159
162
  {:else}
@@ -175,6 +178,7 @@
175
178
  autoscroll={gradio.autoscroll}
176
179
  i18n={gradio.i18n}
177
180
  {...loading_status}
181
+ on:clear_status={() => gradio.dispatch("clear_status", loading_status)}
178
182
  />
179
183
 
180
184
  <Video
@@ -202,6 +206,9 @@
202
206
  on:start_recording={() => gradio.dispatch("start_recording")}
203
207
  on:stop_recording={() => gradio.dispatch("stop_recording")}
204
208
  i18n={gradio.i18n}
209
+ max_file_size={gradio.max_file_size}
210
+ upload={gradio.client.upload}
211
+ stream_handler={gradio.client.stream_factory}
205
212
  >
206
213
  <UploadText i18n={gradio.i18n} type="video" />
207
214
  </Video>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/video",
3
- "version": "0.6.12",
3
+ "version": "0.8.0",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -10,14 +10,17 @@
10
10
  "@ffmpeg/ffmpeg": "^0.12.7",
11
11
  "@ffmpeg/util": "^0.12.1",
12
12
  "mrmime": "^2.0.0",
13
- "@gradio/atoms": "^0.7.0",
14
- "@gradio/client": "^0.16.0",
13
+ "@gradio/atoms": "^0.7.2",
15
14
  "@gradio/icons": "^0.4.0",
16
- "@gradio/statustracker": "^0.4.12",
17
- "@gradio/upload": "^0.8.5",
18
- "@gradio/utils": "^0.3.2",
19
- "@gradio/wasm": "^0.10.0",
20
- "@gradio/image": "^0.9.12"
15
+ "@gradio/client": "^0.18.0",
16
+ "@gradio/image": "^0.11.0",
17
+ "@gradio/statustracker": "^0.5.1",
18
+ "@gradio/upload": "^0.10.0",
19
+ "@gradio/utils": "^0.4.1",
20
+ "@gradio/wasm": "^0.10.1"
21
+ },
22
+ "devDependencies": {
23
+ "@gradio/preview": "^0.9.0"
21
24
  },
22
25
  "exports": {
23
26
  ".": "./index.ts",
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { createEventDispatcher } from "svelte";
3
3
  import { Upload, ModifyUpload } from "@gradio/upload";
4
- import type { FileData } from "@gradio/client";
4
+ import type { FileData, Client } from "@gradio/client";
5
5
  import { BlockLabel } from "@gradio/atoms";
6
6
  import { Webcam } from "@gradio/image";
7
7
  import { Video } from "@gradio/icons";
@@ -28,6 +28,9 @@
28
28
  export let i18n: I18nFormatter;
29
29
  export let active_source: "webcam" | "upload" = "webcam";
30
30
  export let handle_reset_value: () => void = () => {};
31
+ export let max_file_size: number | null = null;
32
+ export let upload: Client["upload"];
33
+ export let stream_handler: Client["stream_factory"];
31
34
 
32
35
  const dispatch = createEventDispatcher<{
33
36
  change: FileData | null;
@@ -77,8 +80,11 @@
77
80
  bind:dragging
78
81
  filetype="video/x-m4v,video/*"
79
82
  on:load={handle_load}
83
+ {max_file_size}
80
84
  on:error={({ detail }) => dispatch("error", detail)}
81
85
  {root}
86
+ {upload}
87
+ {stream_handler}
82
88
  >
83
89
  <slot />
84
90
  </Upload>
@@ -93,6 +99,7 @@
93
99
  on:start_recording
94
100
  on:stop_recording
95
101
  {i18n}
102
+ {upload}
96
103
  />
97
104
  {/if}
98
105
  </div>
@@ -105,6 +112,7 @@
105
112
  {#if playable()}
106
113
  {#key value?.url}
107
114
  <Player
115
+ {upload}
108
116
  {root}
109
117
  interactive
110
118
  {autoplay}
@@ -3,8 +3,8 @@
3
3
  import { Play, Pause, Maximise, Undo } from "@gradio/icons";
4
4
  import Video from "./Video.svelte";
5
5
  import VideoControls from "./VideoControls.svelte";
6
- import type { FileData } from "@gradio/client";
7
- import { prepare_files, upload } from "@gradio/client";
6
+ import type { FileData, Client } from "@gradio/client";
7
+ import { prepare_files } from "@gradio/client";
8
8
  import { format_time } from "@gradio/utils";
9
9
 
10
10
  export let root = "";
@@ -16,6 +16,7 @@
16
16
  export let interactive = false;
17
17
  export let handle_change: (video: FileData) => void = () => {};
18
18
  export let handle_reset_value: () => void = () => {};
19
+ export let upload: Client["upload"];
19
20
 
20
21
  const dispatch = createEventDispatcher<{
21
22
  play: undefined;
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { createEventDispatcher, afterUpdate, tick } from "svelte";
3
3
  import { BlockLabel, Empty, IconButton, ShareButton } from "@gradio/atoms";
4
- import type { FileData } from "@gradio/client";
4
+ import type { FileData, Client } from "@gradio/client";
5
5
  import { Video, Download } from "@gradio/icons";
6
6
  import { uploadToHuggingFace } from "@gradio/utils";
7
7
  import { DownloadLink } from "@gradio/wasm/svelte";
@@ -17,6 +17,7 @@
17
17
  export let show_share_button = true;
18
18
  export let show_download_button = true;
19
19
  export let i18n: I18nFormatter;
20
+ export let upload: Client["upload"];
20
21
 
21
22
  let old_value: FileData | null = null;
22
23
  let old_subtitle: FileData | null = null;
@@ -64,6 +65,7 @@
64
65
  mirror={false}
65
66
  {label}
66
67
  interactive={false}
68
+ {upload}
67
69
  />
68
70
  {/key}
69
71
  <div class="icon-buttons" data-testid="download-div">
@@ -9,7 +9,7 @@
9
9
 
10
10
  let thumbnails: string[] = [];
11
11
  let numberOfThumbnails = 10;
12
- let intervalId: number | NodeJS.Timer;
12
+ let intervalId: ReturnType<typeof setInterval> | undefined;
13
13
  let videoDuration: number;
14
14
 
15
15
  let leftHandlePosition = 0;
@@ -136,7 +136,7 @@
136
136
  window.removeEventListener("mouseup", stopDragging);
137
137
  window.removeEventListener("keydown", moveHandle);
138
138
 
139
- if (intervalId) {
139
+ if (intervalId !== undefined) {
140
140
  clearInterval(intervalId);
141
141
  }
142
142
  });