@gradio/multimodaltextbox 0.2.5 → 0.3.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,49 @@
1
1
  # @gradio/multimodaltextbox
2
2
 
3
+ ## 0.3.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/image@0.10.0
43
+ - @gradio/statustracker@0.5.0
44
+ - @gradio/upload@0.9.0
45
+ - @gradio/utils@0.4.0
46
+
3
47
  ## 0.2.5
4
48
 
5
49
  ### 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,16 @@
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}
93
100
  />
94
101
  </Block>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/multimodaltextbox",
3
- "version": "0.2.5",
3
+ "version": "0.3.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",
17
+ "@gradio/atoms": "^0.7.1",
19
18
  "@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"
19
+ "@gradio/statustracker": "^0.5.0",
20
+ "@gradio/upload": "^0.9.0",
21
+ "@gradio/utils": "^0.4.0",
22
+ "@gradio/client": "^0.17.0",
23
+ "@gradio/image": "^0.10.0"
24
+ },
25
+ "devDependencies": {
26
+ "@gradio/preview": "^0.8.0"
24
27
  }
25
28
  }
@@ -34,6 +34,7 @@
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;
37
38
 
38
39
  let upload_component: Upload;
39
40
  let hidden_upload: HTMLInputElement;
@@ -176,6 +177,7 @@
176
177
 
177
178
  function handle_upload_click(): void {
178
179
  if (hidden_upload) {
180
+ hidden_upload.value = "";
179
181
  hidden_upload.click();
180
182
  }
181
183
  }
@@ -206,11 +208,13 @@
206
208
  on:load={handle_upload}
207
209
  filetype={accept_file_types}
208
210
  {root}
211
+ {max_file_size}
209
212
  bind:dragging
210
213
  bind:uploading
211
214
  show_progress={false}
212
215
  disable_click={true}
213
216
  bind:hidden_upload
217
+ on:error
214
218
  >
215
219
  {#if submit_btn !== null}
216
220
  <button class:disabled class="submit-button" on:click={handle_submit}