@gradio/file 0.5.12 → 0.6.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,48 @@
1
1
  # @gradio/file
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Highlights
6
+
7
+ #### Setting File Upload Limits ([#7909](https://github.com/gradio-app/gradio/pull/7909) [`2afca65`](https://github.com/gradio-app/gradio/commit/2afca6541912b37dc84f447c7ad4af21607d7c72))
8
+
9
+ 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).
10
+
11
+ The following code snippet sets a max file size of 5 megabytes.
12
+
13
+ ```python
14
+ import gradio as gr
15
+
16
+ demo = gr.Interface(lambda x: x, "image", "image")
17
+
18
+ demo.launch(max_file_size="5mb")
19
+ # or
20
+ demo.launch(max_file_size=5 * gr.FileSize.MB)
21
+ ```
22
+
23
+ ![max_file_size_upload](https://github.com/gradio-app/gradio/assets/41651716/7547330c-a082-4901-a291-3f150a197e45)
24
+
25
+
26
+ #### Error states can now be cleared
27
+
28
+ 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.
29
+
30
+ ![error_modal_calculator](https://github.com/gradio-app/gradio/assets/41651716/16cb071c-accd-45a6-9c18-0dea27d4bd98)
31
+
32
+ Thanks @freddyaboulton!
33
+
34
+ ### Fixes
35
+
36
+ - [#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!
37
+
38
+ ### Dependency updates
39
+
40
+ - @gradio/atoms@0.7.1
41
+ - @gradio/client@0.17.0
42
+ - @gradio/statustracker@0.5.0
43
+ - @gradio/upload@0.9.0
44
+ - @gradio/utils@0.4.0
45
+
3
46
  ## 0.5.12
4
47
 
5
48
  ### Dependency updates
package/Index.svelte CHANGED
@@ -39,6 +39,7 @@
39
39
  upload: never;
40
40
  clear: never;
41
41
  select: SelectData;
42
+ clear_status: LoadingStatus;
42
43
  }>;
43
44
  export let file_count: string;
44
45
  export let file_types: string[] = ["file"];
@@ -72,6 +73,7 @@
72
73
  status={pending_upload
73
74
  ? "generating"
74
75
  : loading_status?.status || "complete"}
76
+ on:clear_status={() => gradio.dispatch("clear_status", loading_status)}
75
77
  />
76
78
  {#if !interactive}
77
79
  <File
@@ -93,6 +95,7 @@
93
95
  selectable={_selectable}
94
96
  {root}
95
97
  {height}
98
+ max_file_size={gradio.max_file_size}
96
99
  on:change={({ detail }) => {
97
100
  value = detail;
98
101
  }}
@@ -100,6 +103,11 @@
100
103
  on:clear={() => gradio.dispatch("clear")}
101
104
  on:select={({ detail }) => gradio.dispatch("select", detail)}
102
105
  on:upload={() => gradio.dispatch("upload")}
106
+ on:error={({ detail }) => {
107
+ loading_status = loading_status || {};
108
+ loading_status.status = "error";
109
+ gradio.dispatch("error", detail);
110
+ }}
103
111
  i18n={gradio.i18n}
104
112
  >
105
113
  <UploadText i18n={gradio.i18n} type="file" />
package/package.json CHANGED
@@ -1,20 +1,23 @@
1
1
  {
2
2
  "name": "@gradio/file",
3
- "version": "0.5.12",
3
+ "version": "0.6.0",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
7
7
  "license": "ISC",
8
8
  "private": false,
9
9
  "dependencies": {
10
- "@gradio/atoms": "^0.7.0",
10
+ "@gradio/atoms": "^0.7.1",
11
11
  "@gradio/icons": "^0.4.0",
12
- "@gradio/client": "^0.16.0",
13
- "@gradio/statustracker": "^0.4.12",
14
- "@gradio/utils": "^0.3.2",
15
- "@gradio/upload": "^0.8.5",
12
+ "@gradio/statustracker": "^0.5.0",
13
+ "@gradio/client": "^0.17.0",
14
+ "@gradio/upload": "^0.9.0",
15
+ "@gradio/utils": "^0.4.0",
16
16
  "@gradio/wasm": "^0.10.0"
17
17
  },
18
+ "devDependencies": {
19
+ "@gradio/preview": "^0.8.0"
20
+ },
18
21
  "main": "./Index.svelte",
19
22
  "main_changeset": true,
20
23
  "exports": {
@@ -18,6 +18,7 @@
18
18
  export let root: string;
19
19
  export let height: number | undefined = undefined;
20
20
  export let i18n: I18nFormatter;
21
+ export let max_file_size: number | null = null;
21
22
 
22
23
  async function handle_upload({
23
24
  detail
@@ -62,8 +63,10 @@
62
63
  on:load={handle_upload}
63
64
  filetype={file_types}
64
65
  {file_count}
66
+ {max_file_size}
65
67
  {root}
66
68
  bind:dragging
69
+ on:error
67
70
  >
68
71
  <slot />
69
72
  </Upload>