gradio-pr-bot commited on
Commit
d5a5cfa
·
verified ·
1 Parent(s): e048cec

Upload folder using huggingface_hub

Browse files
6.2.0/video/Index.svelte CHANGED
@@ -100,10 +100,10 @@
100
  show_label={gradio.shared.show_label}
101
  autoplay={gradio.props.autoplay}
102
  loop={gradio.props.loop}
103
- show_share_button={(gradio.props.buttons || []).includes("share")}
104
- show_download_button={(gradio.props.buttons || ["download"]).includes(
105
- "download"
106
- )}
107
  bind:playback_position={gradio.props.playback_position}
108
  on:play={() => gradio.dispatch("play")}
109
  on:pause={() => gradio.dispatch("pause")}
@@ -150,7 +150,10 @@
150
  bind:uploading
151
  label={gradio.shared.label}
152
  show_label={gradio.shared.show_label}
153
- show_download_button={(gradio.props.buttons || []).includes("download")}
 
 
 
154
  sources={gradio.props.sources}
155
  {active_source}
156
  webcam_options={gradio.props.webcam_options}
 
100
  show_label={gradio.shared.show_label}
101
  autoplay={gradio.props.autoplay}
102
  loop={gradio.props.loop}
103
+ buttons={gradio.props.buttons ?? ["download", "share"]}
104
+ on_custom_button_click={(id) => {
105
+ gradio.dispatch("custom_button_click", { id });
106
+ }}
107
  bind:playback_position={gradio.props.playback_position}
108
  on:play={() => gradio.dispatch("play")}
109
  on:pause={() => gradio.dispatch("pause")}
 
150
  bind:uploading
151
  label={gradio.shared.label}
152
  show_label={gradio.shared.show_label}
153
+ buttons={gradio.props.buttons ?? ["download", "share"]}
154
+ on_custom_button_click={(id) => {
155
+ gradio.dispatch("custom_button_click", { id });
156
+ }}
157
  sources={gradio.props.sources}
158
  {active_source}
159
  webcam_options={gradio.props.webcam_options}
6.2.0/video/package.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "@gradio/video",
3
- "version": "0.18.0",
4
  "description": "Gradio UI packages",
5
  "type": "module",
6
  "author": "",
 
1
  {
2
  "name": "@gradio/video",
3
+ "version": "0.19.0",
4
  "description": "Gradio UI packages",
5
  "type": "module",
6
  "author": "",
6.2.0/video/shared/VideoPreview.svelte CHANGED
@@ -11,6 +11,7 @@
11
  import type { FileData, Client } from "@gradio/client";
12
  import { Video, Download } from "@gradio/icons";
13
  import { uploadToHuggingFace } from "@gradio/utils";
 
14
 
15
  import Player from "./Player.svelte";
16
  import type { I18nFormatter } from "js/core/src/gradio_helper";
@@ -20,8 +21,8 @@
20
  export let label: string | undefined = undefined;
21
  export let show_label = true;
22
  export let autoplay: boolean;
23
- export let show_share_button = true;
24
- export let show_download_button = true;
25
  export let loop: boolean;
26
  export let i18n: I18nFormatter;
27
  export let upload: Client["upload"];
@@ -91,8 +92,10 @@
91
  <div data-testid="download-div">
92
  <IconButtonWrapper
93
  display_top_corner={display_icon_button_wrapper_top_corner}
 
 
94
  >
95
- {#if show_download_button}
96
  <DownloadLink
97
  href={value.is_stream
98
  ? value.url?.replace("playlist.m3u8", "playlist-file")
@@ -102,7 +105,7 @@
102
  <IconButton Icon={Download} label="Download" />
103
  </DownloadLink>
104
  {/if}
105
- {#if show_share_button}
106
  <ShareButton
107
  {i18n}
108
  on:error
 
11
  import type { FileData, Client } from "@gradio/client";
12
  import { Video, Download } from "@gradio/icons";
13
  import { uploadToHuggingFace } from "@gradio/utils";
14
+ import type { CustomButton as CustomButtonType } from "@gradio/utils";
15
 
16
  import Player from "./Player.svelte";
17
  import type { I18nFormatter } from "js/core/src/gradio_helper";
 
21
  export let label: string | undefined = undefined;
22
  export let show_label = true;
23
  export let autoplay: boolean;
24
+ export let buttons: (string | CustomButtonType)[] | null = null;
25
+ export let on_custom_button_click: ((id: number) => void) | null = null;
26
  export let loop: boolean;
27
  export let i18n: I18nFormatter;
28
  export let upload: Client["upload"];
 
92
  <div data-testid="download-div">
93
  <IconButtonWrapper
94
  display_top_corner={display_icon_button_wrapper_top_corner}
95
+ buttons={buttons ?? ["download", "share"]}
96
+ {on_custom_button_click}
97
  >
98
+ {#if buttons?.some((btn) => typeof btn === "string" && btn === "download")}
99
  <DownloadLink
100
  href={value.is_stream
101
  ? value.url?.replace("playlist.m3u8", "playlist-file")
 
105
  <IconButton Icon={Download} label="Download" />
106
  </DownloadLink>
107
  {/if}
108
+ {#if buttons?.some((btn) => typeof btn === "string" && btn === "share")}
109
  <ShareButton
110
  {i18n}
111
  on:error
6.2.0/video/types.ts CHANGED
@@ -1,5 +1,6 @@
1
  import type { FileData } from "@gradio/client";
2
  import type { LoadingStatus } from "@gradio/statustracker";
 
3
  import type { WebcamOptions } from "./shared/utils";
4
 
5
  export interface VideoProps {
@@ -7,7 +8,7 @@ export interface VideoProps {
7
  height: number | undefined;
8
  width: number | undefined;
9
  autoplay: boolean;
10
- buttons: ("share" | "download" | "fullscreen")[];
11
  sources:
12
  | ["webcam"]
13
  | ["upload"]
@@ -35,4 +36,5 @@ export interface VideoEvents {
35
  share: any;
36
  error: any;
37
  warning: any;
 
38
  }
 
1
  import type { FileData } from "@gradio/client";
2
  import type { LoadingStatus } from "@gradio/statustracker";
3
+ import type { CustomButton } from "@gradio/utils";
4
  import type { WebcamOptions } from "./shared/utils";
5
 
6
  export interface VideoProps {
 
8
  height: number | undefined;
9
  width: number | undefined;
10
  autoplay: boolean;
11
+ buttons: ("share" | "download" | "fullscreen" | CustomButton)[];
12
  sources:
13
  | ["webcam"]
14
  | ["upload"]
 
36
  share: any;
37
  error: any;
38
  warning: any;
39
+ custom_button_click: { id: number };
40
  }