@gradio/model3d 0.14.26 → 0.15.1-dev.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 +37 -0
- package/Index.svelte +1 -1
- package/dist/Index.svelte.d.ts +1 -1
- package/dist/shared/Canvas3D.svelte +1 -18
- package/dist/shared/Canvas3D.svelte.d.ts +0 -1
- package/dist/shared/Canvas3DGS.svelte +5 -22
- package/dist/shared/Canvas3DGS.svelte.d.ts +0 -1
- package/dist/shared/Model3D.svelte +1 -4
- package/dist/shared/Model3DUpload.svelte.d.ts +1 -1
- package/package.json +5 -6
- package/shared/Canvas3D.svelte +1 -29
- package/shared/Canvas3DGS.svelte +5 -33
- package/shared/Model3D.svelte +1 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @gradio/model3d
|
|
2
2
|
|
|
3
|
+
## 0.15.1-dev.0
|
|
4
|
+
|
|
5
|
+
### Dependency updates
|
|
6
|
+
|
|
7
|
+
- @gradio/upload@0.17.2-dev.0
|
|
8
|
+
- @gradio/client@2.0.0-dev.0
|
|
9
|
+
|
|
10
|
+
## 0.15.0
|
|
11
|
+
|
|
12
|
+
### Dependency updates
|
|
13
|
+
|
|
14
|
+
- @gradio/client@1.19.1
|
|
15
|
+
|
|
16
|
+
## 0.15.0
|
|
17
|
+
|
|
18
|
+
### Dependency updates
|
|
19
|
+
|
|
20
|
+
- @gradio/upload@0.17.1
|
|
21
|
+
- @gradio/atoms@0.18.1
|
|
22
|
+
|
|
23
|
+
## 0.15.0
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
- [#11858](https://github.com/gradio-app/gradio/pull/11858) [`3f8ea13`](https://github.com/gradio-app/gradio/commit/3f8ea13a8ca92abf0ad34392e403a449fda3c6c2) - remove lite. Thanks @pngwn!
|
|
28
|
+
|
|
29
|
+
### Fixes
|
|
30
|
+
|
|
31
|
+
- [#11784](https://github.com/gradio-app/gradio/pull/11784) [`d9dd3f5`](https://github.com/gradio-app/gradio/commit/d9dd3f54b7fb34cf7118e549d39fc63937ca3489) - Add "hidden" option to component's `visible` kwarg to render but visually hide the component. Thanks @pngwn!
|
|
32
|
+
|
|
33
|
+
### Dependency updates
|
|
34
|
+
|
|
35
|
+
- @gradio/statustracker@0.11.1
|
|
36
|
+
- @gradio/atoms@0.18.0
|
|
37
|
+
- @gradio/client@1.19.0
|
|
38
|
+
- @gradio/upload@0.17.0
|
|
39
|
+
|
|
3
40
|
## 0.14.26
|
|
4
41
|
|
|
5
42
|
### Dependency updates
|
package/Index.svelte
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
export let elem_id = "";
|
|
19
19
|
export let elem_classes: string[] = [];
|
|
20
|
-
export let visible = true;
|
|
20
|
+
export let visible: boolean | "hidden" = true;
|
|
21
21
|
export let value: null | FileData = null;
|
|
22
22
|
export let root: string;
|
|
23
23
|
export let display_mode: "solid" | "point_cloud" | "wireframe" = "solid";
|
package/dist/Index.svelte.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script>import { onMount } from "svelte";
|
|
2
|
-
import { resolve_wasm_src } from "@gradio/wasm/svelte";
|
|
3
2
|
let BABYLON_VIEWER;
|
|
4
3
|
export let value;
|
|
5
4
|
export let display_mode;
|
|
@@ -8,22 +7,6 @@ export let camera_position;
|
|
|
8
7
|
export let zoom_speed;
|
|
9
8
|
export let pan_speed;
|
|
10
9
|
$: url = value.url;
|
|
11
|
-
export let resolved_url = void 0;
|
|
12
|
-
let latest_url;
|
|
13
|
-
$: {
|
|
14
|
-
resolved_url = url;
|
|
15
|
-
if (url) {
|
|
16
|
-
latest_url = url;
|
|
17
|
-
const resolving_url = url;
|
|
18
|
-
resolve_wasm_src(url).then((resolved) => {
|
|
19
|
-
if (latest_url === resolving_url) {
|
|
20
|
-
resolved_url = resolved ?? void 0;
|
|
21
|
-
} else {
|
|
22
|
-
resolved && URL.revokeObjectURL(resolved);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
10
|
let canvas;
|
|
28
11
|
let viewer;
|
|
29
12
|
let viewerDetails;
|
|
@@ -49,7 +32,7 @@ onMount(() => {
|
|
|
49
32
|
viewer?.dispose();
|
|
50
33
|
};
|
|
51
34
|
});
|
|
52
|
-
$: mounted && load_model(
|
|
35
|
+
$: mounted && load_model(url);
|
|
53
36
|
function setRenderingMode(pointsCloud, wireframe) {
|
|
54
37
|
viewerDetails.scene.forcePointsCloud = pointsCloud;
|
|
55
38
|
viewerDetails.scene.forceWireframe = wireframe;
|
|
@@ -8,7 +8,6 @@ declare const __propDef: {
|
|
|
8
8
|
camera_position: [number | null, number | null, number | null];
|
|
9
9
|
zoom_speed: number;
|
|
10
10
|
pan_speed: number;
|
|
11
|
-
resolved_url?: string | undefined;
|
|
12
11
|
update_camera?: (camera_position: [number | null, number | null, number | null], zoom_speed: number, pan_speed: number) => void;
|
|
13
12
|
reset_camera_position?: () => void;
|
|
14
13
|
};
|
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
<script>import { onMount } from "svelte";
|
|
2
2
|
import * as SPLAT from "gsplat";
|
|
3
|
-
import { resolve_wasm_src } from "@gradio/wasm/svelte";
|
|
4
3
|
export let value;
|
|
5
4
|
export let zoom_speed;
|
|
6
5
|
export let pan_speed;
|
|
7
6
|
$: url = value.url;
|
|
8
|
-
export let resolved_url = void 0;
|
|
9
|
-
let latest_url;
|
|
10
|
-
$: {
|
|
11
|
-
resolved_url = url;
|
|
12
|
-
if (url) {
|
|
13
|
-
latest_url = url;
|
|
14
|
-
const resolving_url = url;
|
|
15
|
-
resolve_wasm_src(url).then((resolved) => {
|
|
16
|
-
if (latest_url === resolving_url) {
|
|
17
|
-
resolved_url = resolved ?? void 0;
|
|
18
|
-
} else {
|
|
19
|
-
resolved && URL.revokeObjectURL(resolved);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
7
|
let canvas;
|
|
25
8
|
let scene;
|
|
26
9
|
let camera;
|
|
@@ -52,14 +35,14 @@ function reset_scene() {
|
|
|
52
35
|
console.error("Already loading");
|
|
53
36
|
return;
|
|
54
37
|
}
|
|
55
|
-
if (!
|
|
38
|
+
if (!url) {
|
|
56
39
|
throw new Error("No resolved URL");
|
|
57
40
|
}
|
|
58
41
|
loading = true;
|
|
59
|
-
if (
|
|
60
|
-
await SPLAT.PLYLoader.LoadAsync(
|
|
61
|
-
} else if (
|
|
62
|
-
await SPLAT.Loader.LoadAsync(
|
|
42
|
+
if (url.endsWith(".ply")) {
|
|
43
|
+
await SPLAT.PLYLoader.LoadAsync(url, scene, void 0);
|
|
44
|
+
} else if (url.endsWith(".splat")) {
|
|
45
|
+
await SPLAT.Loader.LoadAsync(url, scene, void 0);
|
|
63
46
|
} else {
|
|
64
47
|
throw new Error("Unsupported file type");
|
|
65
48
|
}
|
|
@@ -49,7 +49,6 @@ $: {
|
|
|
49
49
|
current_settings = { camera_position, zoom_speed, pan_speed };
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
let resolved_url;
|
|
53
52
|
</script>
|
|
54
53
|
|
|
55
54
|
<BlockLabel
|
|
@@ -70,7 +69,7 @@ let resolved_url;
|
|
|
70
69
|
/>
|
|
71
70
|
{/if}
|
|
72
71
|
<a
|
|
73
|
-
href={
|
|
72
|
+
href={value.url}
|
|
74
73
|
target={window.__is_colab__ ? "_blank" : null}
|
|
75
74
|
download={window.__is_colab__ ? null : value.orig_name || value.path}
|
|
76
75
|
>
|
|
@@ -81,7 +80,6 @@ let resolved_url;
|
|
|
81
80
|
{#if use_3dgs}
|
|
82
81
|
<svelte:component
|
|
83
82
|
this={Canvas3DGSComponent}
|
|
84
|
-
bind:resolved_url
|
|
85
83
|
{value}
|
|
86
84
|
{zoom_speed}
|
|
87
85
|
{pan_speed}
|
|
@@ -90,7 +88,6 @@ let resolved_url;
|
|
|
90
88
|
<svelte:component
|
|
91
89
|
this={Canvas3DComponent}
|
|
92
90
|
bind:this={canvas3d}
|
|
93
|
-
bind:resolved_url
|
|
94
91
|
{value}
|
|
95
92
|
{display_mode}
|
|
96
93
|
{clear_color}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradio/model3d",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1-dev.0",
|
|
4
4
|
"description": "Gradio UI packages",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "",
|
|
@@ -13,13 +13,12 @@
|
|
|
13
13
|
"@babylonjs/loaders": "^8.2.0",
|
|
14
14
|
"dequal": "^2.0.2",
|
|
15
15
|
"gsplat": "^1.2.9",
|
|
16
|
-
"@gradio/atoms": "^0.
|
|
17
|
-
"@gradio/client": "^
|
|
16
|
+
"@gradio/atoms": "^0.18.1",
|
|
17
|
+
"@gradio/client": "^2.0.0-dev.0",
|
|
18
18
|
"@gradio/icons": "^0.14.0",
|
|
19
|
-
"@gradio/
|
|
20
|
-
"@gradio/statustracker": "^0.11.0",
|
|
19
|
+
"@gradio/statustracker": "^0.11.1",
|
|
21
20
|
"@gradio/utils": "^0.10.2",
|
|
22
|
-
"@gradio/
|
|
21
|
+
"@gradio/upload": "^0.17.2-dev.0"
|
|
23
22
|
},
|
|
24
23
|
"devDependencies": {
|
|
25
24
|
"@gradio/preview": "^0.14.0"
|
package/shared/Canvas3D.svelte
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount } from "svelte";
|
|
3
3
|
import type { FileData } from "@gradio/client";
|
|
4
|
-
import { resolve_wasm_src } from "@gradio/wasm/svelte";
|
|
5
4
|
import type { Viewer, ViewerDetails } from "@babylonjs/viewer";
|
|
6
5
|
|
|
7
6
|
let BABYLON_VIEWER: typeof import("@babylonjs/viewer");
|
|
@@ -15,33 +14,6 @@
|
|
|
15
14
|
|
|
16
15
|
$: url = value.url;
|
|
17
16
|
|
|
18
|
-
/* URL resolution for the Wasm mode. */
|
|
19
|
-
export let resolved_url: typeof url = undefined; // Exposed to be bound to the download link in the parent component.
|
|
20
|
-
// The prop can be updated before the Promise from `resolve_wasm_src` is resolved.
|
|
21
|
-
// In such a case, the resolved url for the old `url` has to be discarded,
|
|
22
|
-
// This variable `latest_url` is used to pick up only the value resolved for the latest `url`.
|
|
23
|
-
let latest_url: typeof url;
|
|
24
|
-
$: {
|
|
25
|
-
// In normal (non-Wasm) Gradio, the original `url` should be used immediately
|
|
26
|
-
// without waiting for `resolve_wasm_src()` to resolve.
|
|
27
|
-
// If it waits, a blank element is displayed until the async task finishes
|
|
28
|
-
// and it leads to undesirable flickering.
|
|
29
|
-
// So set `resolved_url` immediately above, and update it with the resolved values below later.
|
|
30
|
-
resolved_url = url;
|
|
31
|
-
|
|
32
|
-
if (url) {
|
|
33
|
-
latest_url = url;
|
|
34
|
-
const resolving_url = url;
|
|
35
|
-
resolve_wasm_src(url).then((resolved) => {
|
|
36
|
-
if (latest_url === resolving_url) {
|
|
37
|
-
resolved_url = resolved ?? undefined;
|
|
38
|
-
} else {
|
|
39
|
-
resolved && URL.revokeObjectURL(resolved);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
17
|
let canvas: HTMLCanvasElement;
|
|
46
18
|
let viewer: Viewer;
|
|
47
19
|
let viewerDetails: Readonly<ViewerDetails>;
|
|
@@ -71,7 +43,7 @@
|
|
|
71
43
|
};
|
|
72
44
|
});
|
|
73
45
|
|
|
74
|
-
$: mounted && load_model(
|
|
46
|
+
$: mounted && load_model(url);
|
|
75
47
|
|
|
76
48
|
function setRenderingMode(pointsCloud: boolean, wireframe: boolean): void {
|
|
77
49
|
viewerDetails.scene.forcePointsCloud = pointsCloud;
|
package/shared/Canvas3DGS.svelte
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { onMount } from "svelte";
|
|
3
3
|
import * as SPLAT from "gsplat";
|
|
4
4
|
import type { FileData } from "@gradio/client";
|
|
5
|
-
import { resolve_wasm_src } from "@gradio/wasm/svelte";
|
|
6
5
|
|
|
7
6
|
export let value: FileData;
|
|
8
7
|
export let zoom_speed: number;
|
|
@@ -10,33 +9,6 @@
|
|
|
10
9
|
|
|
11
10
|
$: url = value.url;
|
|
12
11
|
|
|
13
|
-
/* URL resolution for the Wasm mode. */
|
|
14
|
-
export let resolved_url: typeof url = undefined; // Exposed to be bound to the download link in the parent component.
|
|
15
|
-
// The prop can be updated before the Promise from `resolve_wasm_src` is resolved.
|
|
16
|
-
// In such a case, the resolved url for the old `url` has to be discarded,
|
|
17
|
-
// This variable `latest_url` is used to pick up only the value resolved for the latest `url`.
|
|
18
|
-
let latest_url: typeof url;
|
|
19
|
-
$: {
|
|
20
|
-
// In normal (non-Wasm) Gradio, the original `url` should be used immediately
|
|
21
|
-
// without waiting for `resolve_wasm_src()` to resolve.
|
|
22
|
-
// If it waits, a blank element is displayed until the async task finishes
|
|
23
|
-
// and it leads to undesirable flickering.
|
|
24
|
-
// So set `resolved_url` immediately above, and update it with the resolved values below later.
|
|
25
|
-
resolved_url = url;
|
|
26
|
-
|
|
27
|
-
if (url) {
|
|
28
|
-
latest_url = url;
|
|
29
|
-
const resolving_url = url;
|
|
30
|
-
resolve_wasm_src(url).then((resolved) => {
|
|
31
|
-
if (latest_url === resolving_url) {
|
|
32
|
-
resolved_url = resolved ?? undefined;
|
|
33
|
-
} else {
|
|
34
|
-
resolved && URL.revokeObjectURL(resolved);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
12
|
let canvas: HTMLCanvasElement;
|
|
41
13
|
let scene: SPLAT.Scene;
|
|
42
14
|
let camera: SPLAT.Camera;
|
|
@@ -73,14 +45,14 @@
|
|
|
73
45
|
console.error("Already loading");
|
|
74
46
|
return;
|
|
75
47
|
}
|
|
76
|
-
if (!
|
|
48
|
+
if (!url) {
|
|
77
49
|
throw new Error("No resolved URL");
|
|
78
50
|
}
|
|
79
51
|
loading = true;
|
|
80
|
-
if (
|
|
81
|
-
await SPLAT.PLYLoader.LoadAsync(
|
|
82
|
-
} else if (
|
|
83
|
-
await SPLAT.Loader.LoadAsync(
|
|
52
|
+
if (url.endsWith(".ply")) {
|
|
53
|
+
await SPLAT.PLYLoader.LoadAsync(url, scene, undefined);
|
|
54
|
+
} else if (url.endsWith(".splat")) {
|
|
55
|
+
await SPLAT.Loader.LoadAsync(url, scene, undefined);
|
|
84
56
|
} else {
|
|
85
57
|
throw new Error("Unsupported file type");
|
|
86
58
|
}
|
package/shared/Model3D.svelte
CHANGED
|
@@ -64,8 +64,6 @@
|
|
|
64
64
|
current_settings = { camera_position, zoom_speed, pan_speed };
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
let resolved_url: string | undefined;
|
|
69
67
|
</script>
|
|
70
68
|
|
|
71
69
|
<BlockLabel
|
|
@@ -86,7 +84,7 @@
|
|
|
86
84
|
/>
|
|
87
85
|
{/if}
|
|
88
86
|
<a
|
|
89
|
-
href={
|
|
87
|
+
href={value.url}
|
|
90
88
|
target={window.__is_colab__ ? "_blank" : null}
|
|
91
89
|
download={window.__is_colab__ ? null : value.orig_name || value.path}
|
|
92
90
|
>
|
|
@@ -97,7 +95,6 @@
|
|
|
97
95
|
{#if use_3dgs}
|
|
98
96
|
<svelte:component
|
|
99
97
|
this={Canvas3DGSComponent}
|
|
100
|
-
bind:resolved_url
|
|
101
98
|
{value}
|
|
102
99
|
{zoom_speed}
|
|
103
100
|
{pan_speed}
|
|
@@ -106,7 +103,6 @@
|
|
|
106
103
|
<svelte:component
|
|
107
104
|
this={Canvas3DComponent}
|
|
108
105
|
bind:this={canvas3d}
|
|
109
|
-
bind:resolved_url
|
|
110
106
|
{value}
|
|
111
107
|
{display_mode}
|
|
112
108
|
{clear_color}
|