@gradio/file 0.5.12 → 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 +62 -0
- package/Index.svelte +10 -0
- package/package.json +10 -7
- package/shared/FileUpload.svelte +8 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,67 @@
|
|
1
1
|
# @gradio/file
|
2
2
|
|
3
|
+
## 0.7.0
|
4
|
+
|
5
|
+
### Features
|
6
|
+
|
7
|
+
- [#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!
|
8
|
+
|
9
|
+
### Fixes
|
10
|
+
|
11
|
+
- [#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!
|
12
|
+
|
13
|
+
### Dependency updates
|
14
|
+
|
15
|
+
- @gradio/atoms@0.7.2
|
16
|
+
- @gradio/client@0.18.0
|
17
|
+
- @gradio/upload@0.10.0
|
18
|
+
- @gradio/utils@0.4.1
|
19
|
+
- @gradio/wasm@0.10.1
|
20
|
+
- @gradio/statustracker@0.5.1
|
21
|
+
|
22
|
+
## 0.6.0
|
23
|
+
|
24
|
+
### Highlights
|
25
|
+
|
26
|
+
#### Setting File Upload Limits ([#7909](https://github.com/gradio-app/gradio/pull/7909) [`2afca65`](https://github.com/gradio-app/gradio/commit/2afca6541912b37dc84f447c7ad4af21607d7c72))
|
27
|
+
|
28
|
+
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).
|
29
|
+
|
30
|
+
The following code snippet sets a max file size of 5 megabytes.
|
31
|
+
|
32
|
+
```python
|
33
|
+
import gradio as gr
|
34
|
+
|
35
|
+
demo = gr.Interface(lambda x: x, "image", "image")
|
36
|
+
|
37
|
+
demo.launch(max_file_size="5mb")
|
38
|
+
# or
|
39
|
+
demo.launch(max_file_size=5 * gr.FileSize.MB)
|
40
|
+
```
|
41
|
+
|
42
|
+

|
43
|
+
|
44
|
+
|
45
|
+
#### Error states can now be cleared
|
46
|
+
|
47
|
+
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.
|
48
|
+
|
49
|
+

|
50
|
+
|
51
|
+
Thanks @freddyaboulton!
|
52
|
+
|
53
|
+
### Fixes
|
54
|
+
|
55
|
+
- [#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!
|
56
|
+
|
57
|
+
### Dependency updates
|
58
|
+
|
59
|
+
- @gradio/atoms@0.7.1
|
60
|
+
- @gradio/client@0.17.0
|
61
|
+
- @gradio/statustracker@0.5.0
|
62
|
+
- @gradio/upload@0.9.0
|
63
|
+
- @gradio/utils@0.4.0
|
64
|
+
|
3
65
|
## 0.5.12
|
4
66
|
|
5
67
|
### 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
|
@@ -85,6 +87,8 @@
|
|
85
87
|
/>
|
86
88
|
{:else}
|
87
89
|
<FileUpload
|
90
|
+
upload={gradio.client.upload}
|
91
|
+
stream_handler={gradio.client.stream_factory}
|
88
92
|
{label}
|
89
93
|
{show_label}
|
90
94
|
{value}
|
@@ -93,6 +97,7 @@
|
|
93
97
|
selectable={_selectable}
|
94
98
|
{root}
|
95
99
|
{height}
|
100
|
+
max_file_size={gradio.max_file_size}
|
96
101
|
on:change={({ detail }) => {
|
97
102
|
value = detail;
|
98
103
|
}}
|
@@ -100,6 +105,11 @@
|
|
100
105
|
on:clear={() => gradio.dispatch("clear")}
|
101
106
|
on:select={({ detail }) => gradio.dispatch("select", detail)}
|
102
107
|
on:upload={() => gradio.dispatch("upload")}
|
108
|
+
on:error={({ detail }) => {
|
109
|
+
loading_status = loading_status || {};
|
110
|
+
loading_status.status = "error";
|
111
|
+
gradio.dispatch("error", detail);
|
112
|
+
}}
|
103
113
|
i18n={gradio.i18n}
|
104
114
|
>
|
105
115
|
<UploadText i18n={gradio.i18n} type="file" />
|
package/package.json
CHANGED
@@ -1,19 +1,22 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gradio/file",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.7.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.
|
10
|
+
"@gradio/atoms": "^0.7.2",
|
11
|
+
"@gradio/client": "^0.18.0",
|
12
|
+
"@gradio/statustracker": "^0.5.1",
|
11
13
|
"@gradio/icons": "^0.4.0",
|
12
|
-
"@gradio/
|
13
|
-
"@gradio/
|
14
|
-
"@gradio/
|
15
|
-
|
16
|
-
|
14
|
+
"@gradio/utils": "^0.4.1",
|
15
|
+
"@gradio/upload": "^0.10.0",
|
16
|
+
"@gradio/wasm": "^0.10.1"
|
17
|
+
},
|
18
|
+
"devDependencies": {
|
19
|
+
"@gradio/preview": "^0.9.0"
|
17
20
|
},
|
18
21
|
"main": "./Index.svelte",
|
19
22
|
"main_changeset": true,
|
package/shared/FileUpload.svelte
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<script lang="ts">
|
2
2
|
import { createEventDispatcher, tick } 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 { File } from "@gradio/icons";
|
7
7
|
|
@@ -18,6 +18,9 @@
|
|
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;
|
22
|
+
export let upload: Client["upload"];
|
23
|
+
export let stream_handler: Client["stream_factory"];
|
21
24
|
|
22
25
|
async function handle_upload({
|
23
26
|
detail
|
@@ -62,8 +65,12 @@
|
|
62
65
|
on:load={handle_upload}
|
63
66
|
filetype={file_types}
|
64
67
|
{file_count}
|
68
|
+
{max_file_size}
|
65
69
|
{root}
|
66
70
|
bind:dragging
|
71
|
+
on:error
|
72
|
+
{stream_handler}
|
73
|
+
{upload}
|
67
74
|
>
|
68
75
|
<slot />
|
69
76
|
</Upload>
|