@gradio/model3d 0.3.0-beta.5 → 0.3.0-beta.8
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 +38 -27
- package/Index.svelte +123 -0
- package/README.md +49 -0
- package/package.json +11 -11
- package/{static → shared}/Model3D.svelte +15 -9
- package/{interactive → shared}/Model3DUpload.svelte +13 -8
- package/shared/utils.ts +5 -10
- package/example/index.ts +0 -1
- package/interactive/InteractiveModel3d.svelte +0 -78
- package/interactive/index.ts +0 -1
- package/static/StaticModel3d.svelte +0 -78
- package/static/index.ts +0 -1
- /package/{example/Model3d.svelte → Example.svelte} +0 -0
package/CHANGELOG.md
CHANGED
@@ -1,52 +1,63 @@
|
|
1
1
|
# @gradio/model3d
|
2
2
|
|
3
|
-
## 0.3.0-beta.
|
3
|
+
## 0.3.0-beta.8
|
4
4
|
|
5
5
|
### Features
|
6
6
|
|
7
|
-
- [#
|
7
|
+
- [#6143](https://github.com/gradio-app/gradio/pull/6143) [`e4f7b4b40`](https://github.com/gradio-app/gradio/commit/e4f7b4b409323b01aa01b39e15ce6139e29aa073) - fix circular dependency with client + upload. Thanks [@pngwn](https://github.com/pngwn)!
|
8
|
+
- [#6136](https://github.com/gradio-app/gradio/pull/6136) [`667802a6c`](https://github.com/gradio-app/gradio/commit/667802a6cdbfb2ce454a3be5a78e0990b194548a) - JS Component Documentation. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
|
9
|
+
- [#6094](https://github.com/gradio-app/gradio/pull/6094) [`c476bd5a5`](https://github.com/gradio-app/gradio/commit/c476bd5a5b70836163b9c69bf4bfe068b17fbe13) - Image v4. Thanks [@pngwn](https://github.com/pngwn)!
|
10
|
+
- [#6149](https://github.com/gradio-app/gradio/pull/6149) [`90318b1dd`](https://github.com/gradio-app/gradio/commit/90318b1dd118ae08a695a50e7c556226234ab6dc) - swap `mode` on the frontned to `interactive` to match the backend. Thanks [@pngwn](https://github.com/pngwn)!
|
8
11
|
|
9
|
-
## 0.3.0-beta.
|
12
|
+
## 0.3.0-beta.7
|
10
13
|
|
11
|
-
###
|
14
|
+
### Features
|
12
15
|
|
13
|
-
-
|
14
|
-
|
15
|
-
- @gradio/atoms@0.2.0-beta.3
|
16
|
-
- @gradio/statustracker@0.3.0-beta.4
|
17
|
-
- @gradio/upload@0.3.0-beta.3
|
16
|
+
- [#6016](https://github.com/gradio-app/gradio/pull/6016) [`83e947676`](https://github.com/gradio-app/gradio/commit/83e947676d327ca2ab6ae2a2d710c78961c771a0) - Format js in v4 branch. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
|
17
|
+
- [#5955](https://github.com/gradio-app/gradio/pull/5955) [`825c9cddc`](https://github.com/gradio-app/gradio/commit/825c9cddc83a09457d8c85ebeecb4bc705572d82) - Fix dev mode model3D. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
|
18
18
|
|
19
|
-
## 0.3.0-beta.
|
19
|
+
## 0.3.0-beta.6
|
20
20
|
|
21
|
-
###
|
21
|
+
### Features
|
22
22
|
|
23
|
-
-
|
24
|
-
|
25
|
-
- @gradio/atoms@0.2.0-beta.2
|
26
|
-
- @gradio/statustracker@0.3.0-beta.3
|
27
|
-
- @gradio/upload@0.3.0-beta.2
|
23
|
+
- [#5960](https://github.com/gradio-app/gradio/pull/5960) [`319c30f3f`](https://github.com/gradio-app/gradio/commit/319c30f3fccf23bfe1da6c9b132a6a99d59652f7) - rererefactor frontend files. Thanks [@pngwn](https://github.com/pngwn)!
|
24
|
+
- [#5938](https://github.com/gradio-app/gradio/pull/5938) [`13ed8a485`](https://github.com/gradio-app/gradio/commit/13ed8a485d5e31d7d75af87fe8654b661edcca93) - V4: Use beta release versions for '@gradio' packages. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
|
28
25
|
|
29
|
-
## 0.
|
26
|
+
## 0.2.5
|
30
27
|
|
31
|
-
###
|
28
|
+
### Patch Changes
|
32
29
|
|
33
|
-
-
|
30
|
+
- Updated dependencies [[`e70805d54`](https://github.com/gradio-app/gradio/commit/e70805d54cc792452545f5d8eccc1aa0212a4695)]:
|
31
|
+
- @gradio/atoms@0.2.0
|
32
|
+
- @gradio/statustracker@0.2.3
|
33
|
+
- @gradio/upload@0.3.3
|
34
34
|
|
35
|
-
## 0.
|
35
|
+
## 0.2.4
|
36
36
|
|
37
37
|
### Patch Changes
|
38
38
|
|
39
39
|
- Updated dependencies []:
|
40
|
-
- @gradio/utils@0.2
|
41
|
-
- @gradio/atoms@0.
|
42
|
-
- @gradio/statustracker@0.
|
43
|
-
- @gradio/upload@0.3.
|
40
|
+
- @gradio/utils@0.1.2
|
41
|
+
- @gradio/atoms@0.1.4
|
42
|
+
- @gradio/statustracker@0.2.2
|
43
|
+
- @gradio/upload@0.3.2
|
44
44
|
|
45
|
-
## 0.3
|
45
|
+
## 0.2.3
|
46
46
|
|
47
|
-
###
|
47
|
+
### Patch Changes
|
48
|
+
|
49
|
+
- Updated dependencies [[`8f0fed857`](https://github.com/gradio-app/gradio/commit/8f0fed857d156830626eb48b469d54d211a582d2)]:
|
50
|
+
- @gradio/icons@0.2.0
|
51
|
+
- @gradio/atoms@0.1.3
|
52
|
+
- @gradio/statustracker@0.2.1
|
53
|
+
- @gradio/upload@0.3.1
|
54
|
+
|
55
|
+
## 0.2.2
|
56
|
+
|
57
|
+
### Patch Changes
|
48
58
|
|
49
|
-
-
|
59
|
+
- Updated dependencies [[`75ddeb390`](https://github.com/gradio-app/gradio/commit/75ddeb390d665d4484667390a97442081b49a423)]:
|
60
|
+
- @gradio/upload@0.3.0
|
50
61
|
|
51
62
|
## 0.2.1
|
52
63
|
|
package/Index.svelte
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
<script context="module" lang="ts">
|
2
|
+
export { default as BaseModel3D } from "./shared/Model3D.svelte";
|
3
|
+
export { default as BaseModel3DUpload } from "./shared/Model3DUpload.svelte";
|
4
|
+
export { default as BaseExample } from "./Example.svelte";
|
5
|
+
</script>
|
6
|
+
|
7
|
+
<script lang="ts">
|
8
|
+
import { normalise_file, type FileData } from "@gradio/client";
|
9
|
+
import Model3D from "./shared/Model3D.svelte";
|
10
|
+
import Model3DUpload from "./shared/Model3DUpload.svelte";
|
11
|
+
import { BlockLabel, Block, Empty, UploadText } from "@gradio/atoms";
|
12
|
+
import { File } from "@gradio/icons";
|
13
|
+
|
14
|
+
import { StatusTracker } from "@gradio/statustracker";
|
15
|
+
import type { LoadingStatus } from "@gradio/statustracker";
|
16
|
+
import type { Gradio } from "@gradio/utils";
|
17
|
+
|
18
|
+
export let elem_id = "";
|
19
|
+
export let elem_classes: string[] = [];
|
20
|
+
export let visible = true;
|
21
|
+
export let value: null | FileData = null;
|
22
|
+
export let root: string;
|
23
|
+
export let root_url: null | string;
|
24
|
+
export let clear_color: [number, number, number, number];
|
25
|
+
export let loading_status: LoadingStatus;
|
26
|
+
export let label: string;
|
27
|
+
export let show_label: boolean;
|
28
|
+
export let container = true;
|
29
|
+
export let scale: number | null = null;
|
30
|
+
export let min_width: number | undefined = undefined;
|
31
|
+
export let gradio: Gradio;
|
32
|
+
export let height: number | undefined = undefined;
|
33
|
+
export let zoom_speed = 1;
|
34
|
+
|
35
|
+
// alpha, beta, radius
|
36
|
+
export let camera_position: [number | null, number | null, number | null] = [
|
37
|
+
null,
|
38
|
+
null,
|
39
|
+
null
|
40
|
+
];
|
41
|
+
export let interactive: boolean;
|
42
|
+
|
43
|
+
let _value: null | FileData;
|
44
|
+
$: _value = normalise_file(value, root, root_url);
|
45
|
+
|
46
|
+
let dragging = false;
|
47
|
+
</script>
|
48
|
+
|
49
|
+
{#if !interactive}
|
50
|
+
<Block
|
51
|
+
{visible}
|
52
|
+
variant={value === null ? "dashed" : "solid"}
|
53
|
+
border_mode={dragging ? "focus" : "base"}
|
54
|
+
padding={false}
|
55
|
+
{elem_id}
|
56
|
+
{elem_classes}
|
57
|
+
{container}
|
58
|
+
{scale}
|
59
|
+
{min_width}
|
60
|
+
{height}
|
61
|
+
>
|
62
|
+
<StatusTracker
|
63
|
+
autoscroll={gradio.autoscroll}
|
64
|
+
i18n={gradio.i18n}
|
65
|
+
{...loading_status}
|
66
|
+
/>
|
67
|
+
|
68
|
+
{#if value}
|
69
|
+
<Model3D
|
70
|
+
value={_value}
|
71
|
+
i18n={gradio.i18n}
|
72
|
+
{clear_color}
|
73
|
+
{label}
|
74
|
+
{show_label}
|
75
|
+
{camera_position}
|
76
|
+
{zoom_speed}
|
77
|
+
/>
|
78
|
+
{:else}
|
79
|
+
<!-- Not ideal but some bugs to work out before we can
|
80
|
+
make this consistent with other components -->
|
81
|
+
|
82
|
+
<BlockLabel {show_label} Icon={File} label={label || "3D Model"} />
|
83
|
+
|
84
|
+
<Empty unpadded_box={true} size="large"><File /></Empty>
|
85
|
+
{/if}
|
86
|
+
</Block>
|
87
|
+
{:else}
|
88
|
+
<Block
|
89
|
+
{visible}
|
90
|
+
variant={value === null ? "dashed" : "solid"}
|
91
|
+
border_mode={dragging ? "focus" : "base"}
|
92
|
+
padding={false}
|
93
|
+
{elem_id}
|
94
|
+
{elem_classes}
|
95
|
+
{container}
|
96
|
+
{scale}
|
97
|
+
{min_width}
|
98
|
+
{height}
|
99
|
+
>
|
100
|
+
<StatusTracker
|
101
|
+
autoscroll={gradio.autoscroll}
|
102
|
+
i18n={gradio.i18n}
|
103
|
+
{...loading_status}
|
104
|
+
/>
|
105
|
+
|
106
|
+
<Model3DUpload
|
107
|
+
{label}
|
108
|
+
{show_label}
|
109
|
+
{root}
|
110
|
+
{clear_color}
|
111
|
+
value={_value}
|
112
|
+
{camera_position}
|
113
|
+
{zoom_speed}
|
114
|
+
on:change={({ detail }) => (value = detail)}
|
115
|
+
on:drag={({ detail }) => (dragging = detail)}
|
116
|
+
on:change={({ detail }) => gradio.dispatch("change", detail)}
|
117
|
+
on:clear={() => gradio.dispatch("clear")}
|
118
|
+
i18n={gradio.i18n}
|
119
|
+
>
|
120
|
+
<UploadText i18n={gradio.i18n} type="file" />
|
121
|
+
</Model3DUpload>
|
122
|
+
</Block>
|
123
|
+
{/if}
|
package/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# `gradio/model3d`
|
2
|
+
|
3
|
+
```html
|
4
|
+
<script>
|
5
|
+
import {BaseModel3D, BaseModel3DUpload, BaseExample } from `@gradio/model3d`;
|
6
|
+
</script>
|
7
|
+
```
|
8
|
+
|
9
|
+
BaseModel3D
|
10
|
+
```javascript
|
11
|
+
export let value: FileData | null;
|
12
|
+
export let clear_color: [number, number, number, number] = [0, 0, 0, 0];
|
13
|
+
export let label = "";
|
14
|
+
export let show_label: boolean;
|
15
|
+
export let i18n: I18nFormatter;
|
16
|
+
export let zoom_speed = 1;
|
17
|
+
|
18
|
+
// alpha, beta, radius
|
19
|
+
export let camera_position: [number | null, number | null, number | null] = [
|
20
|
+
null,
|
21
|
+
null,
|
22
|
+
null
|
23
|
+
];
|
24
|
+
```
|
25
|
+
|
26
|
+
BaseModel3DUpload
|
27
|
+
```javascript
|
28
|
+
export let value: null | FileData;
|
29
|
+
export let clear_color: [number, number, number, number] = [0, 0, 0, 0];
|
30
|
+
export let label = "";
|
31
|
+
export let show_label: boolean;
|
32
|
+
export let root: string;
|
33
|
+
export let i18n: I18nFormatter;
|
34
|
+
export let zoom_speed = 1;
|
35
|
+
|
36
|
+
// alpha, beta, radius
|
37
|
+
export let camera_position: [number | null, number | null, number | null] = [
|
38
|
+
null,
|
39
|
+
null,
|
40
|
+
null
|
41
|
+
];
|
42
|
+
```
|
43
|
+
|
44
|
+
BaseExample
|
45
|
+
```javascript
|
46
|
+
export let value: string;
|
47
|
+
export let type: "gallery" | "table";
|
48
|
+
export let selected = false;
|
49
|
+
```
|
package/package.json
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gradio/model3d",
|
3
|
-
"version": "0.3.0-beta.
|
3
|
+
"version": "0.3.0-beta.8",
|
4
4
|
"description": "Gradio UI packages",
|
5
5
|
"type": "module",
|
6
|
-
"main": "./index.svelte",
|
7
6
|
"author": "",
|
8
7
|
"license": "ISC",
|
9
8
|
"private": false,
|
@@ -11,17 +10,18 @@
|
|
11
10
|
"@types/babylon": "^6.16.6",
|
12
11
|
"babylonjs": "^4.2.1",
|
13
12
|
"babylonjs-loaders": "^4.2.1",
|
14
|
-
"@gradio/atoms": "^0.2.0-beta.
|
15
|
-
"@gradio/
|
16
|
-
"@gradio/
|
17
|
-
"@gradio/
|
18
|
-
"@gradio/
|
13
|
+
"@gradio/atoms": "^0.2.0-beta.6",
|
14
|
+
"@gradio/client": "^0.7.0-beta.1",
|
15
|
+
"@gradio/icons": "^0.2.0-beta.3",
|
16
|
+
"@gradio/statustracker": "^0.3.0-beta.8",
|
17
|
+
"@gradio/upload": "^0.3.0-beta.6",
|
18
|
+
"@gradio/utils": "^0.2.0-beta.6"
|
19
19
|
},
|
20
20
|
"main_changeset": true,
|
21
|
+
"main": "./Index.svelte",
|
21
22
|
"exports": {
|
22
|
-
"
|
23
|
-
"./
|
24
|
-
"./
|
25
|
-
"./example": "./example/index.ts"
|
23
|
+
".": "./Index.svelte",
|
24
|
+
"./example": "./Example.svelte",
|
25
|
+
"./package.json": "./package.json"
|
26
26
|
}
|
27
27
|
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<script lang="ts">
|
2
|
-
import type { FileData } from "@gradio/
|
2
|
+
import type { FileData } from "@gradio/client";
|
3
3
|
import { BlockLabel, IconButton } from "@gradio/atoms";
|
4
4
|
import { File, Download, Undo } from "@gradio/icons";
|
5
|
-
import { add_new_model, reset_camera_position } from "
|
5
|
+
import { add_new_model, reset_camera_position } from "./utils";
|
6
6
|
import { onMount } from "svelte";
|
7
7
|
import * as BABYLON from "babylonjs";
|
8
8
|
import * as BABYLON_LOADERS from "babylonjs-loaders";
|
@@ -22,7 +22,14 @@
|
|
22
22
|
null
|
23
23
|
];
|
24
24
|
|
25
|
-
|
25
|
+
$: {
|
26
|
+
if (
|
27
|
+
BABYLON_LOADERS.OBJFileLoader != undefined &&
|
28
|
+
!BABYLON_LOADERS.OBJFileLoader.IMPORT_VERTEX_COLORS
|
29
|
+
) {
|
30
|
+
BABYLON_LOADERS.OBJFileLoader.IMPORT_VERTEX_COLORS = true;
|
31
|
+
}
|
32
|
+
}
|
26
33
|
|
27
34
|
let canvas: HTMLCanvasElement;
|
28
35
|
let scene: BABYLON.Scene;
|
@@ -37,12 +44,11 @@
|
|
37
44
|
mounted = true;
|
38
45
|
});
|
39
46
|
|
40
|
-
$: ({
|
41
|
-
|
42
|
-
name: undefined
|
47
|
+
$: ({ path } = value || {
|
48
|
+
path: undefined
|
43
49
|
});
|
44
50
|
|
45
|
-
$: canvas && mounted &&
|
51
|
+
$: canvas && mounted && path && dispose();
|
46
52
|
|
47
53
|
function dispose(): void {
|
48
54
|
if (scene && !scene.isDisposed) {
|
@@ -83,9 +89,9 @@
|
|
83
89
|
<div class="buttons">
|
84
90
|
<IconButton Icon={Undo} label="Undo" on:click={() => handle_undo()} />
|
85
91
|
<a
|
86
|
-
href={value.
|
92
|
+
href={value.path}
|
87
93
|
target={window.__is_colab__ ? "_blank" : null}
|
88
|
-
download={window.__is_colab__ ? null : value.orig_name || value.
|
94
|
+
download={window.__is_colab__ ? null : value.orig_name || value.path}
|
89
95
|
>
|
90
96
|
<IconButton Icon={Download} label={i18n("common.download")} />
|
91
97
|
</a>
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<script lang="ts">
|
2
2
|
import { createEventDispatcher, tick, onMount } from "svelte";
|
3
3
|
import { Upload, ModifyUpload } from "@gradio/upload";
|
4
|
-
import type { FileData } from "@gradio/
|
4
|
+
import type { FileData } from "@gradio/client";
|
5
5
|
import { BlockLabel } from "@gradio/atoms";
|
6
6
|
import { File } from "@gradio/icons";
|
7
|
-
import { add_new_model, reset_camera_position } from "
|
7
|
+
import { add_new_model, reset_camera_position } from "./utils";
|
8
8
|
|
9
9
|
export let value: null | FileData;
|
10
10
|
export let clear_color: [number, number, number, number] = [0, 0, 0, 0];
|
@@ -45,13 +45,11 @@
|
|
45
45
|
mounted = true;
|
46
46
|
});
|
47
47
|
|
48
|
-
$: ({
|
49
|
-
|
50
|
-
is_file: undefined,
|
51
|
-
name: undefined
|
48
|
+
$: ({ path } = value || {
|
49
|
+
path: undefined
|
52
50
|
});
|
53
51
|
|
54
|
-
$: canvas && mounted &&
|
52
|
+
$: canvas && mounted && path != null && reset_scene();
|
55
53
|
|
56
54
|
async function handle_upload({
|
57
55
|
detail
|
@@ -88,7 +86,14 @@
|
|
88
86
|
import * as BABYLON_LOADERS from "babylonjs-loaders";
|
89
87
|
import type { I18nFormatter } from "js/utils/src";
|
90
88
|
|
91
|
-
|
89
|
+
$: {
|
90
|
+
if (
|
91
|
+
BABYLON_LOADERS.OBJFileLoader != undefined &&
|
92
|
+
!BABYLON_LOADERS.OBJFileLoader.IMPORT_VERTEX_COLORS
|
93
|
+
) {
|
94
|
+
BABYLON_LOADERS.OBJFileLoader.IMPORT_VERTEX_COLORS = true;
|
95
|
+
}
|
96
|
+
}
|
92
97
|
|
93
98
|
$: dispatch("drag", dragging);
|
94
99
|
</script>
|
package/shared/utils.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { FileData } from "@gradio/
|
1
|
+
import type { FileData } from "@gradio/client";
|
2
2
|
import * as BABYLON from "babylonjs";
|
3
3
|
|
4
4
|
const create_camera = (
|
@@ -53,14 +53,9 @@ export const add_new_model = (
|
|
53
53
|
|
54
54
|
if (!value) return scene;
|
55
55
|
let url: string;
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
let base64_model_content = value.data;
|
60
|
-
let raw_content = BABYLON.Tools.DecodeBase64(base64_model_content);
|
61
|
-
let blob = new Blob([raw_content]);
|
62
|
-
url = URL.createObjectURL(blob);
|
63
|
-
}
|
56
|
+
|
57
|
+
url = value.url!;
|
58
|
+
|
64
59
|
BABYLON.SceneLoader.ShowLoadingScreen = false;
|
65
60
|
BABYLON.SceneLoader.Append(
|
66
61
|
url,
|
@@ -69,7 +64,7 @@ export const add_new_model = (
|
|
69
64
|
() => create_camera(scene, camera_position, zoom_speed),
|
70
65
|
undefined,
|
71
66
|
undefined,
|
72
|
-
"." + value.
|
67
|
+
"." + value.path.split(".")[1]
|
73
68
|
);
|
74
69
|
return scene;
|
75
70
|
};
|
package/example/index.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export { default } from "./Model3d.svelte";
|
@@ -1,78 +0,0 @@
|
|
1
|
-
<script lang="ts">
|
2
|
-
import type { Gradio } from "@gradio/utils";
|
3
|
-
import type { FileData } from "@gradio/upload";
|
4
|
-
import { normalise_file } from "@gradio/upload";
|
5
|
-
import Model3DUpload from "./Model3DUpload.svelte";
|
6
|
-
import { Block, UploadText } from "@gradio/atoms";
|
7
|
-
|
8
|
-
import { StatusTracker } from "@gradio/statustracker";
|
9
|
-
import type { LoadingStatus } from "@gradio/statustracker";
|
10
|
-
|
11
|
-
export let elem_id = "";
|
12
|
-
export let elem_classes: string[] = [];
|
13
|
-
export let visible = true;
|
14
|
-
export let value: null | FileData = null;
|
15
|
-
export let root: string;
|
16
|
-
export let root_url: null | string;
|
17
|
-
export let clear_color: [number, number, number, number];
|
18
|
-
export let loading_status: LoadingStatus;
|
19
|
-
export let label: string;
|
20
|
-
export let show_label: boolean;
|
21
|
-
export let container = true;
|
22
|
-
export let scale: number | null = null;
|
23
|
-
export let min_width: number | undefined = undefined;
|
24
|
-
export let gradio: Gradio<{
|
25
|
-
change: typeof value;
|
26
|
-
clear: never;
|
27
|
-
}>;
|
28
|
-
export let zoom_speed = 1;
|
29
|
-
export let height: number | undefined = undefined;
|
30
|
-
|
31
|
-
// alpha, beta, radius
|
32
|
-
export let camera_position: [number | null, number | null, number | null] = [
|
33
|
-
null,
|
34
|
-
null,
|
35
|
-
null
|
36
|
-
];
|
37
|
-
|
38
|
-
let _value: null | FileData;
|
39
|
-
$: _value = normalise_file(value, root, root_url);
|
40
|
-
|
41
|
-
let dragging = false;
|
42
|
-
</script>
|
43
|
-
|
44
|
-
<Block
|
45
|
-
{visible}
|
46
|
-
variant={value === null ? "dashed" : "solid"}
|
47
|
-
border_mode={dragging ? "focus" : "base"}
|
48
|
-
padding={false}
|
49
|
-
{elem_id}
|
50
|
-
{elem_classes}
|
51
|
-
{container}
|
52
|
-
{scale}
|
53
|
-
{min_width}
|
54
|
-
{height}
|
55
|
-
>
|
56
|
-
<StatusTracker
|
57
|
-
autoscroll={gradio.autoscroll}
|
58
|
-
i18n={gradio.i18n}
|
59
|
-
{...loading_status}
|
60
|
-
/>
|
61
|
-
|
62
|
-
<Model3DUpload
|
63
|
-
{label}
|
64
|
-
{show_label}
|
65
|
-
{root}
|
66
|
-
{clear_color}
|
67
|
-
value={_value}
|
68
|
-
{camera_position}
|
69
|
-
{zoom_speed}
|
70
|
-
on:change={({ detail }) => (value = detail)}
|
71
|
-
on:drag={({ detail }) => (dragging = detail)}
|
72
|
-
on:change={({ detail }) => gradio.dispatch("change", detail)}
|
73
|
-
on:clear={() => gradio.dispatch("clear")}
|
74
|
-
i18n={gradio.i18n}
|
75
|
-
>
|
76
|
-
<UploadText i18n={gradio.i18n} type="file" />
|
77
|
-
</Model3DUpload>
|
78
|
-
</Block>
|
package/interactive/index.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export { default } from "./InteractiveModel3d.svelte";
|
@@ -1,78 +0,0 @@
|
|
1
|
-
<script lang="ts">
|
2
|
-
import type { FileData } from "@gradio/upload";
|
3
|
-
import { normalise_file } from "@gradio/upload";
|
4
|
-
import Model3D from "./Model3D.svelte";
|
5
|
-
import { BlockLabel, Block, Empty } from "@gradio/atoms";
|
6
|
-
import { File } from "@gradio/icons";
|
7
|
-
|
8
|
-
import { StatusTracker } from "@gradio/statustracker";
|
9
|
-
import type { LoadingStatus } from "@gradio/statustracker";
|
10
|
-
import type { Gradio } from "@gradio/utils";
|
11
|
-
|
12
|
-
export let elem_id = "";
|
13
|
-
export let elem_classes: string[] = [];
|
14
|
-
export let visible = true;
|
15
|
-
export let value: null | FileData = null;
|
16
|
-
export let root: string;
|
17
|
-
export let root_url: null | string;
|
18
|
-
export let clear_color: [number, number, number, number];
|
19
|
-
export let loading_status: LoadingStatus;
|
20
|
-
export let label: string;
|
21
|
-
export let show_label: boolean;
|
22
|
-
export let container = true;
|
23
|
-
export let scale: number | null = null;
|
24
|
-
export let min_width: number | undefined = undefined;
|
25
|
-
export let gradio: Gradio;
|
26
|
-
export let height: number | undefined = undefined;
|
27
|
-
export let zoom_speed = 1;
|
28
|
-
|
29
|
-
// alpha, beta, radius
|
30
|
-
export let camera_position: [number | null, number | null, number | null] = [
|
31
|
-
null,
|
32
|
-
null,
|
33
|
-
null
|
34
|
-
];
|
35
|
-
|
36
|
-
let _value: null | FileData;
|
37
|
-
$: _value = normalise_file(value, root, root_url);
|
38
|
-
|
39
|
-
let dragging = false;
|
40
|
-
</script>
|
41
|
-
|
42
|
-
<Block
|
43
|
-
{visible}
|
44
|
-
variant={value === null ? "dashed" : "solid"}
|
45
|
-
border_mode={dragging ? "focus" : "base"}
|
46
|
-
padding={false}
|
47
|
-
{elem_id}
|
48
|
-
{elem_classes}
|
49
|
-
{container}
|
50
|
-
{scale}
|
51
|
-
{min_width}
|
52
|
-
{height}
|
53
|
-
>
|
54
|
-
<StatusTracker
|
55
|
-
autoscroll={gradio.autoscroll}
|
56
|
-
i18n={gradio.i18n}
|
57
|
-
{...loading_status}
|
58
|
-
/>
|
59
|
-
|
60
|
-
{#if value}
|
61
|
-
<Model3D
|
62
|
-
value={_value}
|
63
|
-
i18n={gradio.i18n}
|
64
|
-
{clear_color}
|
65
|
-
{label}
|
66
|
-
{show_label}
|
67
|
-
{camera_position}
|
68
|
-
{zoom_speed}
|
69
|
-
/>
|
70
|
-
{:else}
|
71
|
-
<!-- Not ideal but some bugs to work out before we can
|
72
|
-
make this consistent with other components -->
|
73
|
-
|
74
|
-
<BlockLabel {show_label} Icon={File} label={label || "3D Model"} />
|
75
|
-
|
76
|
-
<Empty unpadded_box={true} size="large"><File /></Empty>
|
77
|
-
{/if}
|
78
|
-
</Block>
|
package/static/index.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export { default } from "./StaticModel3d.svelte";
|
File without changes
|