gradio-pr-bot commited on
Commit
f81d576
·
verified ·
1 Parent(s): 0176081

Upload folder using huggingface_hub

Browse files
6.7.0/html/Index.svelte CHANGED
@@ -10,7 +10,6 @@
10
  import { Block, BlockLabel, IconButtonWrapper } from "@gradio/atoms";
11
  import { Code as CodeIcon } from "@gradio/icons";
12
  import { css_units } from "@gradio/utils";
13
- import { prepare_files } from "@gradio/client";
14
  import type { HTMLProps, HTMLEvents } from "./types.ts";
15
  import type { Snippet } from "svelte";
16
 
@@ -32,20 +31,6 @@
32
  gradio.dispatch("change");
33
  }
34
  });
35
-
36
- async function upload(file: File): Promise<string> {
37
- const file_data = await prepare_files([file]);
38
- const result = await gradio.shared.client.upload(
39
- file_data,
40
- gradio.shared.root,
41
- undefined,
42
- gradio.shared.max_file_size ?? undefined
43
- );
44
- if (result && result[0]) {
45
- return result[0].path;
46
- }
47
- throw new Error("Upload failed");
48
- }
49
  </script>
50
 
51
  <Block
@@ -104,7 +89,6 @@
104
  autoscroll={gradio.shared.autoscroll}
105
  apply_default_css={gradio.props.apply_default_css}
106
  component_class_name={gradio.props.component_class_name}
107
- {upload}
108
  on:event={(e) => {
109
  gradio.dispatch(e.detail.type, e.detail.data);
110
  }}
 
10
  import { Block, BlockLabel, IconButtonWrapper } from "@gradio/atoms";
11
  import { Code as CodeIcon } from "@gradio/icons";
12
  import { css_units } from "@gradio/utils";
 
13
  import type { HTMLProps, HTMLEvents } from "./types.ts";
14
  import type { Snippet } from "svelte";
15
 
 
31
  gradio.dispatch("change");
32
  }
33
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  </script>
35
 
36
  <Block
 
89
  autoscroll={gradio.shared.autoscroll}
90
  apply_default_css={gradio.props.apply_default_css}
91
  component_class_name={gradio.props.component_class_name}
 
92
  on:event={(e) => {
93
  gradio.dispatch(e.detail.type, e.detail.data);
94
  }}
6.7.0/html/package.json CHANGED
@@ -9,7 +9,6 @@
9
  "main_changeset": true,
10
  "dependencies": {
11
  "@gradio/atoms": "workspace:^",
12
- "@gradio/client": "workspace:^",
13
  "@gradio/icons": "workspace:^",
14
  "@gradio/statustracker": "workspace:^",
15
  "@gradio/utils": "workspace:^",
 
9
  "main_changeset": true,
10
  "dependencies": {
11
  "@gradio/atoms": "workspace:^",
 
12
  "@gradio/icons": "workspace:^",
13
  "@gradio/statustracker": "workspace:^",
14
  "@gradio/utils": "workspace:^",
6.7.0/html/shared/HTML.svelte CHANGED
@@ -13,7 +13,6 @@
13
  autoscroll = false,
14
  apply_default_css = true,
15
  component_class_name = "HTML",
16
- upload = null,
17
  children
18
  }: {
19
  elem_classes: string[];
@@ -25,7 +24,6 @@
25
  autoscroll: boolean;
26
  apply_default_css: boolean;
27
  component_class_name: string;
28
- upload: ((file: File) => Promise<string>) | null;
29
  children?: Snippet;
30
  } = $props();
31
 
@@ -361,19 +359,8 @@
361
 
362
  if (js_on_load && element) {
363
  try {
364
- const upload_func =
365
- upload ??
366
- (async (_file: File): Promise<string> => {
367
- throw new Error("upload is not available in this context");
368
- });
369
- const func = new Function(
370
- "element",
371
- "trigger",
372
- "props",
373
- "upload",
374
- js_on_load
375
- );
376
- func(element, trigger, reactiveProps, upload_func);
377
  } catch (error) {
378
  console.error("Error executing js_on_load:", error);
379
  }
 
13
  autoscroll = false,
14
  apply_default_css = true,
15
  component_class_name = "HTML",
 
16
  children
17
  }: {
18
  elem_classes: string[];
 
24
  autoscroll: boolean;
25
  apply_default_css: boolean;
26
  component_class_name: string;
 
27
  children?: Snippet;
28
  } = $props();
29
 
 
359
 
360
  if (js_on_load && element) {
361
  try {
362
+ const func = new Function("element", "trigger", "props", js_on_load);
363
+ func(element, trigger, reactiveProps);
 
 
 
 
 
 
 
 
 
 
 
364
  } catch (error) {
365
  console.error("Error executing js_on_load:", error);
366
  }