Langelaw commited on
Commit
5197189
1 Parent(s): 9254a66

Upload folder using huggingface_hub

Browse files
.gitignore ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ .eggs/
2
+ dist/
3
+ *.pyc
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+ __tmp/*
8
+ *.pyi
9
+ node_modules
README.md CHANGED
@@ -1,17 +1,249 @@
1
 
2
- ---
3
- tags: [gradio-custom-component,gradio-template-Fallback]
4
- title: gradio_model4dgs V0.0.3
5
- colorFrom: pink
6
- colorTo: gray
7
- sdk: docker
8
- pinned: false
9
- license: apache-2.0
10
- ---
11
 
 
12
 
13
- # Name: gradio_model4dgs
14
 
15
- Description: Python library for easily interacting with trained machine learning models
 
 
16
 
17
- Install with: pip install gradio_model4dgs
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
+ # `gradio_model4dgs`
3
+ <a href="https://pypi.org/project/gradio_model4dgs/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_model4dgs"></a>
 
 
 
 
 
 
 
4
 
5
+ Python library for easily interacting with trained machine learning models
6
 
7
+ ## Installation
8
 
9
+ ```bash
10
+ pip install gradio_model4dgs
11
+ ```
12
 
13
+ ## Usage
14
+
15
+ ```python
16
+ import gradio as gr
17
+ from gradio_model4dgs import Model4DGS
18
+ import os
19
+
20
+ image_dir = os.path.join(os.path.dirname(__file__), "assets")
21
+
22
+ if os.path.exists(image_dir) and os.path.isdir(image_dir) and os.listdir(image_dir):
23
+ examples = [os.path.join(image_dir, file) for file in os.listdir(image_dir)]
24
+ else:
25
+ examples = [os.path.join(os.path.dirname(__file__), example) for example in Model4DGS().example_inputs()]
26
+
27
+ with gr.Blocks() as demo:
28
+ with gr.Row():
29
+ Model4DGS(value=examples, label="4D Model")
30
+
31
+ if __name__ == "__main__":
32
+ demo.launch(share=True)
33
+ ```
34
+
35
+ ## `Model4DGS`
36
+
37
+ ### Initialization
38
+
39
+ <table>
40
+ <thead>
41
+ <tr>
42
+ <th align="left">name</th>
43
+ <th align="left" style="width: 25%;">type</th>
44
+ <th align="left">default</th>
45
+ <th align="left">description</th>
46
+ </tr>
47
+ </thead>
48
+ <tbody>
49
+ <tr>
50
+ <td align="left"><code>value</code></td>
51
+ <td align="left" style="width: 25%;">
52
+
53
+ ```python
54
+ str | Callable | None
55
+ ```
56
+
57
+ </td>
58
+ <td align="left"><code>None</code></td>
59
+ <td align="left">path to (.splat) file to show in model4DGS viewer. If callable, the function will be called whenever the app loads to set the initial value of the component.</td>
60
+ </tr>
61
+
62
+ <tr>
63
+ <td align="left"><code>height</code></td>
64
+ <td align="left" style="width: 25%;">
65
+
66
+ ```python
67
+ int | None
68
+ ```
69
+
70
+ </td>
71
+ <td align="left"><code>None</code></td>
72
+ <td align="left">height of the model4DGS component, in pixels.</td>
73
+ </tr>
74
+
75
+ <tr>
76
+ <td align="left"><code>label</code></td>
77
+ <td align="left" style="width: 25%;">
78
+
79
+ ```python
80
+ str | None
81
+ ```
82
+
83
+ </td>
84
+ <td align="left"><code>None</code></td>
85
+ <td align="left">None</td>
86
+ </tr>
87
+
88
+ <tr>
89
+ <td align="left"><code>show_label</code></td>
90
+ <td align="left" style="width: 25%;">
91
+
92
+ ```python
93
+ bool | None
94
+ ```
95
+
96
+ </td>
97
+ <td align="left"><code>None</code></td>
98
+ <td align="left">None</td>
99
+ </tr>
100
+
101
+ <tr>
102
+ <td align="left"><code>every</code></td>
103
+ <td align="left" style="width: 25%;">
104
+
105
+ ```python
106
+ float | None
107
+ ```
108
+
109
+ </td>
110
+ <td align="left"><code>None</code></td>
111
+ <td align="left">None</td>
112
+ </tr>
113
+
114
+ <tr>
115
+ <td align="left"><code>container</code></td>
116
+ <td align="left" style="width: 25%;">
117
+
118
+ ```python
119
+ bool
120
+ ```
121
+
122
+ </td>
123
+ <td align="left"><code>True</code></td>
124
+ <td align="left">None</td>
125
+ </tr>
126
+
127
+ <tr>
128
+ <td align="left"><code>scale</code></td>
129
+ <td align="left" style="width: 25%;">
130
+
131
+ ```python
132
+ int | None
133
+ ```
134
+
135
+ </td>
136
+ <td align="left"><code>None</code></td>
137
+ <td align="left">None</td>
138
+ </tr>
139
+
140
+ <tr>
141
+ <td align="left"><code>min_width</code></td>
142
+ <td align="left" style="width: 25%;">
143
+
144
+ ```python
145
+ int
146
+ ```
147
+
148
+ </td>
149
+ <td align="left"><code>160</code></td>
150
+ <td align="left">None</td>
151
+ </tr>
152
+
153
+ <tr>
154
+ <td align="left"><code>interactive</code></td>
155
+ <td align="left" style="width: 25%;">
156
+
157
+ ```python
158
+ bool | None
159
+ ```
160
+
161
+ </td>
162
+ <td align="left"><code>None</code></td>
163
+ <td align="left">None</td>
164
+ </tr>
165
+
166
+ <tr>
167
+ <td align="left"><code>visible</code></td>
168
+ <td align="left" style="width: 25%;">
169
+
170
+ ```python
171
+ bool
172
+ ```
173
+
174
+ </td>
175
+ <td align="left"><code>True</code></td>
176
+ <td align="left">None</td>
177
+ </tr>
178
+
179
+ <tr>
180
+ <td align="left"><code>elem_id</code></td>
181
+ <td align="left" style="width: 25%;">
182
+
183
+ ```python
184
+ str | None
185
+ ```
186
+
187
+ </td>
188
+ <td align="left"><code>None</code></td>
189
+ <td align="left">None</td>
190
+ </tr>
191
+
192
+ <tr>
193
+ <td align="left"><code>elem_classes</code></td>
194
+ <td align="left" style="width: 25%;">
195
+
196
+ ```python
197
+ list[str] | str | None
198
+ ```
199
+
200
+ </td>
201
+ <td align="left"><code>None</code></td>
202
+ <td align="left">None</td>
203
+ </tr>
204
+
205
+ <tr>
206
+ <td align="left"><code>render</code></td>
207
+ <td align="left" style="width: 25%;">
208
+
209
+ ```python
210
+ bool
211
+ ```
212
+
213
+ </td>
214
+ <td align="left"><code>True</code></td>
215
+ <td align="left">None</td>
216
+ </tr>
217
+ </tbody></table>
218
+
219
+
220
+ ### Events
221
+
222
+ | name | description |
223
+ |:-----|:------------|
224
+ | `change` | Triggered when the value of the Model4DGS changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input. |
225
+ | `upload` | This listener is triggered when the user uploads a file into the Model4DGS. |
226
+ | `edit` | This listener is triggered when the user edits the Model4DGS (e.g. image) using the built-in editor. |
227
+ | `clear` | This listener is triggered when the user clears the Model4DGS using the X button for the component. |
228
+
229
+
230
+
231
+ ### User function
232
+
233
+ The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).
234
+
235
+ - When used as an Input, the component only impacts the input signature of the user function.
236
+ - When used as an output, the component only impacts the return signature of the user function.
237
+
238
+ The code snippet below is accurate in cases where the component is used as both an input and an output.
239
+
240
+ - **As output:** Is passed, the preprocessed input data sent to the user's function in the backend.
241
+ - **As input:** Should return, the output data received by the component from the user's function in the backend.
242
+
243
+ ```python
244
+ def predict(
245
+ value: List[str] | None
246
+ ) -> List[str] | str | None:
247
+ return value
248
+ ```
249
+
src/backend/gradio_model4dgs/templates/component/index.js CHANGED
The diff for this file is too large to render. See raw diff
 
src/backend/gradio_model4dgs/templates/example/index.js CHANGED
@@ -1,11 +1,11 @@
1
  const {
2
- SvelteComponent: f,
3
- append: u,
4
- attr: d,
5
  detach: g,
6
  element: o,
7
- init: v,
8
- insert: r,
9
  noop: c,
10
  safe_not_equal: y,
11
  set_data: m,
@@ -19,7 +19,7 @@ function w(a) {
19
  e = o("div"), n = b(
20
  /*value*/
21
  a[0]
22
- ), d(e, "class", "svelte-1gecy8w"), i(
23
  e,
24
  "table",
25
  /*type*/
@@ -37,7 +37,7 @@ function w(a) {
37
  );
38
  },
39
  m(t, l) {
40
- r(t, e, l), u(e, n);
41
  },
42
  p(t, [l]) {
43
  l & /*value*/
@@ -73,16 +73,16 @@ function w(a) {
73
  };
74
  }
75
  function h(a, e, n) {
76
- let { value: t } = e, { type: l } = e, { selected: _ = !1 } = e;
77
  return a.$$set = (s) => {
78
- "value" in s && n(0, t = s.value), "type" in s && n(1, l = s.type), "selected" in s && n(2, _ = s.selected);
79
- }, [t, l, _];
80
  }
81
- class E extends f {
82
  constructor(e) {
83
- super(), v(this, e, h, w, y, { value: 0, type: 1, selected: 2 });
84
  }
85
  }
86
  export {
87
- E as default
88
  };
 
1
  const {
2
+ SvelteComponent: u,
3
+ append: d,
4
+ attr: _,
5
  detach: g,
6
  element: o,
7
+ init: r,
8
+ insert: v,
9
  noop: c,
10
  safe_not_equal: y,
11
  set_data: m,
 
19
  e = o("div"), n = b(
20
  /*value*/
21
  a[0]
22
+ ), _(e, "class", "svelte-1gecy8w"), i(
23
  e,
24
  "table",
25
  /*type*/
 
37
  );
38
  },
39
  m(t, l) {
40
+ v(t, e, l), d(e, n);
41
  },
42
  p(t, [l]) {
43
  l & /*value*/
 
73
  };
74
  }
75
  function h(a, e, n) {
76
+ let { value: t } = e, { type: l } = e, { selected: f = !1 } = e;
77
  return a.$$set = (s) => {
78
+ "value" in s && n(0, t = s.value), "type" in s && n(1, l = s.type), "selected" in s && n(2, f = s.selected);
79
+ }, [t, l, f];
80
  }
81
+ class q extends u {
82
  constructor(e) {
83
+ super(), r(this, e, h, w, y, { value: 0, type: 1, selected: 2 });
84
  }
85
  }
86
  export {
87
+ q as default
88
  };
src/frontend/package-lock.json CHANGED
The diff for this file is too large to render. See raw diff
 
src/frontend/package.json CHANGED
@@ -17,7 +17,10 @@
17
  "@gradio/client": "0.10.1",
18
  "@gradio/statustracker": "0.4.4",
19
  "@gradio/utils": "0.2.1",
20
- "@mkkellogg/gaussian-splats-3d": "^0.2.3",
21
  "three": "^0.162.0"
 
 
 
22
  }
23
  }
 
17
  "@gradio/client": "0.10.1",
18
  "@gradio/statustracker": "0.4.4",
19
  "@gradio/utils": "0.2.1",
20
+ "@mkkellogg/gaussian-splats-3d": "^0.4.1",
21
  "three": "^0.162.0"
22
+ },
23
+ "devDependencies": {
24
+ "@gradio/preview": "^0.9.0"
25
  }
26
  }