gradio-pr-bot commited on
Commit
da6682c
·
verified ·
1 Parent(s): e1fe259

Upload folder using huggingface_hub

Browse files
6.0.0-dev.6/dataframe-interim/Example.svelte ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ export let value: (string | number)[][] | string;
3
+ export let type: "gallery" | "table";
4
+ export let selected = false;
5
+ export let index: number;
6
+
7
+ let hovered = false;
8
+ let loaded = Array.isArray(value);
9
+ let is_empty = loaded && (value.length === 0 || value[0].length === 0);
10
+ </script>
11
+
12
+ {#if loaded}
13
+ <!-- TODO: fix-->
14
+ <!-- svelte-ignore a11y-no-static-element-interactions-->
15
+ <div
16
+ class:table={type === "table"}
17
+ class:gallery={type === "gallery"}
18
+ class:selected
19
+ on:mouseenter={() => (hovered = true)}
20
+ on:mouseleave={() => (hovered = false)}
21
+ >
22
+ {#if typeof value === "string"}
23
+ {value}
24
+ {:else if is_empty}
25
+ <table class="">
26
+ <tbody>
27
+ <tr>
28
+ <td>Empty</td>
29
+ </tr>
30
+ </tbody>
31
+ </table>
32
+ {:else}
33
+ <table class="">
34
+ <tbody>
35
+ {#each value.slice(0, 3) as row, i}
36
+ <tr>
37
+ {#each row.slice(0, 3) as cell, j}
38
+ <td>{cell}</td>
39
+ {/each}
40
+ {#if row.length > 3}
41
+ <td>…</td>
42
+ {/if}
43
+ </tr>
44
+ {/each}
45
+ </tbody>
46
+ </table>
47
+ {#if value.length > 3}
48
+ <div
49
+ class="overlay"
50
+ class:odd={index % 2 != 0}
51
+ class:even={index % 2 == 0}
52
+ class:button={type === "gallery"}
53
+ ></div>
54
+ {/if}
55
+ {/if}
56
+ </div>
57
+ {/if}
58
+
59
+ <style>
60
+ table {
61
+ position: relative;
62
+ border-collapse: collapse;
63
+ }
64
+
65
+ td {
66
+ border: 1px solid var(--table-border-color);
67
+ padding: var(--size-2);
68
+ font-size: var(--text-sm);
69
+ font-family: var(--font-mono);
70
+ }
71
+
72
+ .selected td {
73
+ border-color: var(--border-color-accent);
74
+ }
75
+
76
+ .table {
77
+ display: inline-block;
78
+ margin: 0 auto;
79
+ }
80
+
81
+ .gallery td:first-child {
82
+ border-left: none;
83
+ }
84
+
85
+ .gallery tr:first-child td {
86
+ border-top: none;
87
+ }
88
+
89
+ .gallery td:last-child {
90
+ border-right: none;
91
+ }
92
+
93
+ .gallery tr:last-child td {
94
+ border-bottom: none;
95
+ }
96
+
97
+ .overlay {
98
+ --gradient-to: transparent;
99
+ position: absolute;
100
+ bottom: 0;
101
+ background: linear-gradient(to bottom, transparent, var(--gradient-to));
102
+ width: var(--size-full);
103
+ height: 50%;
104
+ }
105
+
106
+ /* i dont know what i've done here but it is what it is */
107
+ .odd {
108
+ --gradient-to: var(--table-even-background-fill);
109
+ }
110
+
111
+ .even {
112
+ --gradient-to: var(--table-odd-background-fill);
113
+ }
114
+
115
+ .button {
116
+ --gradient-to: var(--background-fill-primary);
117
+ }
118
+ </style>
6.0.0-dev.6/dataframe-interim/Index.svelte ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <svelte:options accessors={true} />
2
+
3
+ <script context="module" lang="ts">
4
+ </script>
5
+
6
+ <script lang="ts">
7
+ import DF from "@gradio/dataframe-npm";
8
+ </script>
9
+
10
+ <DF {...$$props} />
6.0.0-dev.6/dataframe-interim/package.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@gradio/dataframe-interim",
3
+ "version": "0.21.0-dev.3",
4
+ "description": "Gradio UI packages",
5
+ "type": "module",
6
+ "author": "",
7
+ "license": "ISC",
8
+ "private": true,
9
+ "main_changeset": true,
10
+ "main": "./Index.svelte",
11
+ "scripts": {
12
+ "build": "vite build"
13
+ },
14
+ "dependencies": {
15
+ "@gradio/atoms": "npm:@gradio/[email protected]",
16
+ "@gradio/button": "npm:@gradio/[email protected]",
17
+ "@gradio/checkbox": "npm:@gradio/[email protected]",
18
+ "@gradio/markdown-code": "npm:@gradio/[email protected]",
19
+ "@gradio/icons": "npm:@gradio/[email protected]",
20
+ "@gradio/client": "npm:@gradio/[email protected]",
21
+ "@gradio/statustracker": "npm:@gradio/[email protected]",
22
+ "@gradio/upload": "npm:@gradio/[email protected]",
23
+ "@gradio/utils": "npm:@gradio/[email protected]",
24
+ "@gradio/image": "npm:@gradio/[email protected]",
25
+ "@gradio/dataframe-npm": "npm:@gradio/[email protected]",
26
+ "@sveltejs/vite-plugin-svelte": "^3.1.2",
27
+ "svelte": "4",
28
+ "vite": "^5.4.21"
29
+ },
30
+ "exports": {
31
+ ".": {
32
+ "gradio": "./dist/index.js",
33
+ "default": "./dist/index.js"
34
+ },
35
+ "./css": {
36
+ "gradio": "./dist/style.css",
37
+ "default": "./dist/style.css"
38
+ },
39
+ "./example": {
40
+ "gradio": "./Example.svelte",
41
+ "svelte": "./dist/Example.svelte",
42
+ "types": "./dist/Example.svelte.d.ts"
43
+ },
44
+ "./package.json": "./package.json"
45
+ },
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/gradio-app/gradio.git",
49
+ "directory": "js/dataframe"
50
+ },
51
+ "overrides": {
52
+ "@gradio/atoms": "npm:@gradio/atoms@^0.18.1",
53
+ "@gradio/button": "npm:@gradio/button@^0.5.13",
54
+ "@gradio/checkbox": "npm:@gradio/checkbox@^0.4.30",
55
+ "@gradio/markdown-code": "npm:@gradio/markdown-code@^0.5.2",
56
+ "@gradio/icons": "npm:@gradio/icons@^0.14.0",
57
+ "@gradio/client": "npm:@gradio/client@^1.19.0",
58
+ "@gradio/statustracker": "npm:@gradio/statustracker@^0.11.1",
59
+ "@gradio/upload": "npm:@gradio/upload@^0.17.1",
60
+ "@gradio/utils": "npm:@gradio/utils@^0.10.2",
61
+ "@gradio/image": "npm:@gradio/[email protected]"
62
+ }
63
+ }
6.0.0-dev.6/dataframe-interim/vite.config.ts ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { defineConfig, type Plugin } from "vite";
2
+ import { svelte, vitePreprocess } from "@sveltejs/vite-plugin-svelte";
3
+ import path from "path";
4
+ import { fileURLToPath } from "url";
5
+
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = path.dirname(__filename);
8
+
9
+ const dir = path.resolve(__dirname);
10
+
11
+ console.log({ dir });
12
+
13
+ function gradioPlugin(): Plugin {
14
+ console.log("Initializing gradio plugin");
15
+ return {
16
+ enforce: "pre",
17
+ name: "gradio",
18
+ resolveId(id, importer) {
19
+ if (id.startsWith("@gradio/image")) {
20
+ return path.resolve(
21
+ dir,
22
+ "node_modules",
23
+ "@gradio",
24
+ "image",
25
+ "Index.svelte"
26
+ );
27
+ }
28
+ }
29
+ };
30
+ }
31
+ export default defineConfig({
32
+ plugins: [svelte({ preprocess: vitePreprocess() }), gradioPlugin()],
33
+ resolve: {
34
+ conditions: ["gradio", "svelte", "browser", "import", "default"]
35
+ },
36
+ build: {
37
+ minify: false,
38
+ sourcemap: true,
39
+ lib: {
40
+ entry: "./Index.svelte",
41
+ formats: ["es"],
42
+ fileName: "index"
43
+ }
44
+ }
45
+ });