@gradio/multimodaltextbox 0.2.5 → 0.4.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,69 @@
1
1
  # @gradio/multimodaltextbox
2
2
 
3
+ ## 0.4.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/statustracker@0.5.1
21
+ - @gradio/image@0.11.0
22
+
23
+ ## 0.3.0
24
+
25
+ ### Highlights
26
+
27
+ #### Setting File Upload Limits ([#7909](https://github.com/gradio-app/gradio/pull/7909) [`2afca65`](https://github.com/gradio-app/gradio/commit/2afca6541912b37dc84f447c7ad4af21607d7c72))
28
+
29
+ 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).
30
+
31
+ The following code snippet sets a max file size of 5 megabytes.
32
+
33
+ ```python
34
+ import gradio as gr
35
+
36
+ demo = gr.Interface(lambda x: x, "image", "image")
37
+
38
+ demo.launch(max_file_size="5mb")
39
+ # or
40
+ demo.launch(max_file_size=5 * gr.FileSize.MB)
41
+ ```
42
+
43
+ ![max_file_size_upload](https://github.com/gradio-app/gradio/assets/41651716/7547330c-a082-4901-a291-3f150a197e45)
44
+
45
+
46
+ #### Error states can now be cleared
47
+
48
+ 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.
49
+
50
+ ![error_modal_calculator](https://github.com/gradio-app/gradio/assets/41651716/16cb071c-accd-45a6-9c18-0dea27d4bd98)
51
+
52
+ Thanks @freddyaboulton!
53
+
54
+ ### Fixes
55
+
56
+ - [#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!
57
+
58
+ ### Dependency updates
59
+
60
+ - @gradio/atoms@0.7.1
61
+ - @gradio/client@0.17.0
62
+ - @gradio/image@0.10.0
63
+ - @gradio/statustracker@0.5.0
64
+ - @gradio/upload@0.9.0
65
+ - @gradio/utils@0.4.0
66
+
3
67
  ## 0.2.5
4
68
 
5
69
  ### Fixes
package/Index.svelte CHANGED
@@ -20,6 +20,8 @@
20
20
  select: SelectData;
21
21
  input: never;
22
22
  focus: never;
23
+ error: string;
24
+ clear_status: LoadingStatus;
23
25
  }>;
24
26
  export let elem_id = "";
25
27
  export let elem_classes: string[] = [];
@@ -63,6 +65,7 @@
63
65
  autoscroll={gradio.autoscroll}
64
66
  i18n={gradio.i18n}
65
67
  {...loading_status}
68
+ on:clear_status={() => gradio.dispatch("clear_status", loading_status)}
66
69
  />
67
70
  {/if}
68
71
 
@@ -83,12 +86,18 @@
83
86
  {autofocus}
84
87
  {container}
85
88
  {autoscroll}
89
+ max_file_size={gradio.max_file_size}
86
90
  on:change={() => gradio.dispatch("change", value)}
87
91
  on:input={() => gradio.dispatch("input")}
88
92
  on:submit={() => gradio.dispatch("submit")}
89
93
  on:blur={() => gradio.dispatch("blur")}
90
94
  on:select={(e) => gradio.dispatch("select", e.detail)}
91
95
  on:focus={() => gradio.dispatch("focus")}
96
+ on:error={({ detail }) => {
97
+ gradio.dispatch("error", detail);
98
+ }}
92
99
  disabled={!interactive}
100
+ upload={gradio.client.upload}
101
+ stream_handler={gradio.client.stream_factory}
93
102
  />
94
103
  </Block>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/multimodaltextbox",
3
- "version": "0.2.5",
3
+ "version": "0.4.0",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -14,12 +14,15 @@
14
14
  "./package.json": "./package.json"
15
15
  },
16
16
  "dependencies": {
17
- "@gradio/atoms": "^0.7.0",
18
- "@gradio/statustracker": "^0.4.12",
19
17
  "@gradio/icons": "^0.4.0",
20
- "@gradio/utils": "^0.3.2",
21
- "@gradio/upload": "^0.8.5",
22
- "@gradio/image": "^0.9.12",
23
- "@gradio/client": "^0.16.0"
18
+ "@gradio/atoms": "^0.7.2",
19
+ "@gradio/statustracker": "^0.5.1",
20
+ "@gradio/upload": "^0.10.0",
21
+ "@gradio/utils": "^0.4.1",
22
+ "@gradio/image": "^0.11.0",
23
+ "@gradio/client": "^0.18.0"
24
+ },
25
+ "devDependencies": {
26
+ "@gradio/preview": "^0.9.0"
24
27
  }
25
28
  }
@@ -9,7 +9,7 @@
9
9
  import { BlockTitle } from "@gradio/atoms";
10
10
  import { Upload } from "@gradio/upload";
11
11
  import { Image } from "@gradio/image/shared";
12
- import type { FileData, upload } from "@gradio/client";
12
+ import type { FileData, Client } from "@gradio/client";
13
13
  import { Clear, File, Music, Video, Send } from "@gradio/icons";
14
14
  import type { SelectData } from "@gradio/utils";
15
15
 
@@ -34,6 +34,9 @@
34
34
  export let autoscroll = true;
35
35
  export let root: string;
36
36
  export let file_types: string[] | null = null;
37
+ export let max_file_size: number | null = null;
38
+ export let upload: Client["upload"];
39
+ export let stream_handler: Client["stream_factory"];
37
40
 
38
41
  let upload_component: Upload;
39
42
  let hidden_upload: HTMLInputElement;
@@ -176,6 +179,7 @@
176
179
 
177
180
  function handle_upload_click(): void {
178
181
  if (hidden_upload) {
182
+ hidden_upload.value = "";
179
183
  hidden_upload.click();
180
184
  }
181
185
  }
@@ -206,11 +210,15 @@
206
210
  on:load={handle_upload}
207
211
  filetype={accept_file_types}
208
212
  {root}
213
+ {max_file_size}
209
214
  bind:dragging
210
215
  bind:uploading
211
216
  show_progress={false}
212
217
  disable_click={true}
213
218
  bind:hidden_upload
219
+ on:error
220
+ {upload}
221
+ {stream_handler}
214
222
  >
215
223
  {#if submit_btn !== null}
216
224
  <button class:disabled class="submit-button" on:click={handle_submit}
package/shared/utils.ts CHANGED
@@ -18,8 +18,8 @@ export async function resize(
18
18
  max_lines === undefined
19
19
  ? false
20
20
  : max_lines === undefined // default
21
- ? 21 * 11
22
- : 21 * (max_lines + 1);
21
+ ? 21 * 11
22
+ : 21 * (max_lines + 1);
23
23
  let min = 21 * (lines + 1);
24
24
 
25
25
  target.style.height = "1px";