gradio-pr-bot commited on
Commit
35bf021
·
verified ·
1 Parent(s): ba6c50e

Upload folder using huggingface_hub

Browse files
6.2.0/gallery/Index.svelte CHANGED
@@ -152,12 +152,22 @@
152
  allow_preview={gradio.props.allow_preview}
153
  bind:selected_index={gradio.props.selected_index}
154
  bind:value={gradio.props.value}
155
- show_share_button={gradio.props.buttons.includes("share")}
156
- show_download_button={gradio.props.buttons.includes("download")}
 
 
 
 
157
  fit_columns={gradio.props.fit_columns}
158
  i18n={gradio.i18n}
159
  _fetch={(...args) => gradio.shared.client.fetch(...args)}
160
- show_fullscreen_button={gradio.props.buttons.includes("fullscreen")}
 
 
 
 
 
 
161
  {fullscreen}
162
  root={gradio.shared.root}
163
  file_types={gradio.props.file_types}
 
152
  allow_preview={gradio.props.allow_preview}
153
  bind:selected_index={gradio.props.selected_index}
154
  bind:value={gradio.props.value}
155
+ show_share_button={gradio.props.buttons.some(
156
+ (btn) => typeof btn === "string" && btn === "share"
157
+ )}
158
+ show_download_button={gradio.props.buttons.some(
159
+ (btn) => typeof btn === "string" && btn === "download"
160
+ )}
161
  fit_columns={gradio.props.fit_columns}
162
  i18n={gradio.i18n}
163
  _fetch={(...args) => gradio.shared.client.fetch(...args)}
164
+ show_fullscreen_button={gradio.props.buttons.some(
165
+ (btn) => typeof btn === "string" && btn === "fullscreen"
166
+ )}
167
+ buttons={gradio.props.buttons}
168
+ on_custom_button_click={(id) => {
169
+ gradio.dispatch("custom_button_click", { id });
170
+ }}
171
  {fullscreen}
172
  root={gradio.shared.root}
173
  file_types={gradio.props.file_types}
6.2.0/gallery/package.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "@gradio/gallery",
3
- "version": "0.15.36",
4
  "description": "Gradio UI packages",
5
  "type": "module",
6
  "author": "",
 
1
  {
2
  "name": "@gradio/gallery",
3
+ "version": "0.16.0",
4
  "description": "Gradio UI packages",
5
  "type": "module",
6
  "author": "",
6.2.0/gallery/shared/Gallery.svelte CHANGED
@@ -7,6 +7,7 @@
7
  IconButtonWrapper,
8
  FullscreenButton
9
  } from "@gradio/atoms";
 
10
  import { ModifyUpload, Upload as UploadComponent } from "@gradio/upload";
11
  import type { SelectData } from "@gradio/utils";
12
  import { Image } from "@gradio/image/shared";
@@ -57,6 +58,8 @@
57
  export let stream_handler: Client["stream"] | undefined = undefined;
58
  export let fit_columns = true;
59
  export let upload_promise: Promise<any> | null = null;
 
 
60
 
61
  let is_full_screen = false;
62
  let image_container: HTMLElement;
@@ -330,6 +333,8 @@
330
  >
331
  <IconButtonWrapper
332
  display_top_corner={display_icon_button_wrapper_top_corner}
 
 
333
  >
334
  {#if show_download_button}
335
  <IconButton
 
7
  IconButtonWrapper,
8
  FullscreenButton
9
  } from "@gradio/atoms";
10
+ import type { CustomButton as CustomButtonType } from "@gradio/utils";
11
  import { ModifyUpload, Upload as UploadComponent } from "@gradio/upload";
12
  import type { SelectData } from "@gradio/utils";
13
  import { Image } from "@gradio/image/shared";
 
58
  export let stream_handler: Client["stream"] | undefined = undefined;
59
  export let fit_columns = true;
60
  export let upload_promise: Promise<any> | null = null;
61
+ export let buttons: (string | CustomButtonType)[] | null = null;
62
+ export let on_custom_button_click: ((id: number) => void) | null = null;
63
 
64
  let is_full_screen = false;
65
  let image_container: HTMLElement;
 
333
  >
334
  <IconButtonWrapper
335
  display_top_corner={display_icon_button_wrapper_top_corner}
336
+ {buttons}
337
+ {on_custom_button_click}
338
  >
339
  {#if show_download_button}
340
  <IconButton
6.2.0/gallery/types.ts CHANGED
@@ -1,4 +1,5 @@
1
  import type { FileData, SelectData } from "@gradio/client";
 
2
 
3
  export interface GalleryImage {
4
  image: FileData;
@@ -22,7 +23,7 @@ export interface GalleryProps {
22
  allow_preview: boolean;
23
  selected_index: number | null;
24
  object_fit: "contain" | "cover" | "fill" | "none" | "scale-down";
25
- buttons: string[];
26
  type: "numpy" | "pil" | "filepath";
27
  fit_columns: boolean;
28
  }
@@ -37,4 +38,5 @@ export interface GalleryEvents {
37
  clear_status: any;
38
  share: any;
39
  error: any;
 
40
  }
 
1
  import type { FileData, SelectData } from "@gradio/client";
2
+ import type { CustomButton } from "@gradio/utils";
3
 
4
  export interface GalleryImage {
5
  image: FileData;
 
23
  allow_preview: boolean;
24
  selected_index: number | null;
25
  object_fit: "contain" | "cover" | "fill" | "none" | "scale-down";
26
+ buttons: (string | CustomButton)[];
27
  type: "numpy" | "pil" | "filepath";
28
  fit_columns: boolean;
29
  }
 
38
  clear_status: any;
39
  share: any;
40
  error: any;
41
+ custom_button_click: { id: number };
42
  }