Spaces:
Runtime error
Runtime error
kolibril13
commited on
Commit
β’
16e9d92
1
Parent(s):
2d7a391
add
Browse files- README.md +4 -16
- pages/01_app.ipynb +0 -244
- pages/01_widget.ipynb +99 -0
- requirements.txt +1 -1
README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
---
|
2 |
title: MolecularNodes with Solara
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: docker
|
7 |
pinned: false
|
8 |
license: mit
|
@@ -10,16 +10,4 @@ app_port: 8765
|
|
10 |
duplicated_from: giswqs/solara-geospatial
|
11 |
---
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
A collection of [Solara](https://github.com/widgetti/solara) web apps for geospatial applications
|
16 |
-
|
17 |
-
Just a proof-of-concept for now. Not all features are working yet. More features will be added in the future.
|
18 |
-
|
19 |
-
- Web App: <https://giswqs-solara-geospatial.hf.space>
|
20 |
-
- GitHub: <https://github.com/opengeos/solara-geospatial>
|
21 |
-
- Hugging Face: <https://huggingface.co/spaces/giswqs/solara-geospatial>
|
22 |
-
|
23 |
-
## Demos
|
24 |
-
|
25 |
-
![](https://i.imgur.com/4uIEnAJ.gif)
|
|
|
1 |
---
|
2 |
title: MolecularNodes with Solara
|
3 |
+
emoji: π
|
4 |
+
colorFrom: yellow
|
5 |
+
colorTo: blue
|
6 |
sdk: docker
|
7 |
pinned: false
|
8 |
license: mit
|
|
|
10 |
duplicated_from: giswqs/solara-geospatial
|
11 |
---
|
12 |
|
13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/01_app.ipynb
DELETED
@@ -1,244 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"cells": [
|
3 |
-
{
|
4 |
-
"cell_type": "code",
|
5 |
-
"execution_count": 1,
|
6 |
-
"metadata": {},
|
7 |
-
"outputs": [
|
8 |
-
{
|
9 |
-
"name": "stdout",
|
10 |
-
"output_type": "stream",
|
11 |
-
"text": [
|
12 |
-
"Device with name Apple M1 supports metal minimum requirements\n",
|
13 |
-
"Finsihed opening molecule after 0.22209199999999996 seconds\n",
|
14 |
-
"Adding object to scene.\n",
|
15 |
-
"Added res_id after 0.0002569999999999517 s\n",
|
16 |
-
"Added res_name after 0.002530999999999839 s\n",
|
17 |
-
"Added atomic_number after 0.003058000000000227 s\n",
|
18 |
-
"Added b_factor after 4.500000000007276e-05 s\n",
|
19 |
-
"Added vdw_radii after 0.0031120000000002257 s\n",
|
20 |
-
"Added chain_id after 0.000496000000000052 s\n",
|
21 |
-
"Added entity_id after 0.0002420000000000755 s\n",
|
22 |
-
"Added atom_name after 0.0019409999999999705 s\n",
|
23 |
-
"Added lipophobicity after 0.003919000000000228 s\n",
|
24 |
-
"Added charge after 0.0038169999999997373 s\n",
|
25 |
-
"Added is_backbone after 0.000376000000000154 s\n",
|
26 |
-
"Added is_alpha_carbon after 0.00012599999999984846 s\n",
|
27 |
-
"Added is_solvent after 0.00012699999999998823 s\n",
|
28 |
-
"Added is_nucleic after 0.0005660000000000664 s\n",
|
29 |
-
"Added is_peptide after 0.0008569999999998856 s\n",
|
30 |
-
"Added is_hetero after 0.00010400000000032605 s\n",
|
31 |
-
"Added is_carb after 0.0006049999999997446 s\n",
|
32 |
-
"Added sec_struct after 0.0018339999999996692 s\n",
|
33 |
-
"Finsihed add object after 0.030968000000000107 seconds\n",
|
34 |
-
"METAL API - DETECTED GPU: Apple M1\n",
|
35 |
-
"Fra:1 Mem:58.21M (Peak 62.13M) | Time:00:00.09 | Syncing Light\n",
|
36 |
-
"Fra:1 Mem:58.21M (Peak 62.13M) | Time:00:00.09 | Syncing Camera\n",
|
37 |
-
"Fra:1 Mem:58.21M (Peak 62.13M) | Time:00:00.09 | Syncing 7TYG\n",
|
38 |
-
"Fra:1 Mem:69.90M (Peak 73.03M) | Time:00:00.12 | Rendering 1 / 64 samples\n",
|
39 |
-
"Fra:1 Mem:60.64M (Peak 73.03M) | Time:00:00.21 | Rendering 26 / 64 samples\n",
|
40 |
-
"Fra:1 Mem:60.64M (Peak 73.03M) | Time:00:00.27 | Rendering 51 / 64 samples\n",
|
41 |
-
"Fra:1 Mem:60.64M (Peak 73.03M) | Time:00:00.30 | Rendering 64 / 64 samples\n",
|
42 |
-
"Saved: '/var/folders/c3/3bzrl3qx043bknt1ycn3fcym0000gn/T/tmp6cvuhryo.JPEG'\n",
|
43 |
-
" Time: 00:00.40 (Saving: 00:00.09)\n",
|
44 |
-
"\n"
|
45 |
-
]
|
46 |
-
},
|
47 |
-
{
|
48 |
-
"data": {
|
49 |
-
"image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/4QAMTmVvR2VvAAAAWv/+ABpCbGVuZGVyOkZpbGU6PHVudGl0bGVkPgD//gAjQmxlbmRlcjpEYXRlOjIwMjMvMTAvMTggMTc6MTM6MjEA//4AG0JsZW5kZXI6VGltZTowMDowMDowMDowMQD//gAUQmxlbmRlcjpGcmFtZTowMDEA//4AGEJsZW5kZXI6Q2FtZXJhOkNhbWVyYQD//gAWQmxlbmRlcjpTY2VuZTpTY2VuZQD//gAeQmxlbmRlcjpSZW5kZXJUaW1lOjAwOjAwLjMwAP/bAEMAAwICAwICAwMDAwQDAwQFCAUFBAQFCgcHBggMCgwMCwoLCw0OEhANDhEOCwsQFhARExQVFRUMDxcYFhQYEhQVFP/bAEMBAwQEBQQFCQUFCRQNCw0UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFP/AABEIASACAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APmaiiloASiijtQAUtJRQAUd6KKACiiigAooooAKKKKACiiloASiiigAoxS0lABRRS0AJRRRQAUtJRQAUtJRQAUUdqKAFpKKKACiiigAooooAWkoooAKKKKACiiigAoNGKKACiiigAo60tJQAUUtJQAUUUUAFFFFABRilpKAClpKKACiiloASlpKKACiiigAooooAOtFFLQAlFFFABRRS0AJRRRQAUUUUAFFFLQAlFFLQAlLSYoNABRRRQAUUdKKACilpKACiiigBaSig0AFFFFABRRRQAUUUUABooooAKKKKACgUUtACUUUUAFHSiigAooooAWkoooAKKKKACiiigAooo60AFFH1paAEooooAKKKKADFFFFABRilpOKACiiigAooooAKKKKACiiigApaSigAooooAM0UUUALSUUUAFFFFAC0mKKKACiiloASiiigA/WilpKACiiloASlpKKADvRRRQAdaKKKACiiigApaSigAooooAO9FFFABRRRQAUUUUAFFFFABmiiigApaSigAooo70AFFFFABRRS0AJ3opaSgAoopaAE+lFFFABmlpKKACiiigAooooAKKKKACiiigAoopaAEooooAKKKWgBKKKO9ABRRRQAUUUtACUUUtACUUUUAFGaKKACiloAycDrQAlBq7qOjX2k+V9stZbbzVDp5i43CoLKFbm9t4XcRJLIqFyPu5PWq5XfltqBDijrXo3xN8E6D4XtLP+z7wrfbQHtZGLtID/AB+304HpX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G3YGNxh43GVcehqpdTrPKWSMQpkkRryFz1x7VDRV88nHlvoB2OneLrR/Df8AZ97GVnhXEUyorZ4xwCOCB+dc9oZhj1yCRyqRGXcxkYAAdOc/hWfRW7xEpcvN0Hc9S8TaTdeD5bPUNMmme2WHayZDQlepDAHjPY+3XNcxpOtrqXiGwvb9oy7XIWVc4zkKobnjtzWBHrN7Fp/2FLmRbTdu8rPGf8PaqZHGO1bzxV5JxWm9guevan4X03QNI8Q2rXsyxXMZcIJfujn7o47kCvIRwB3+vNOeSSUqXkkk2jau9ycD0GabWOIrRq2UVZIG7hRRRXIIO9FFFABRRRQAUUUUAFFFFABmiiigApaSigAooo70AFFFFABRRS0AJ3opaSgAoopaAE+lFFFABmlpKKACiiigAooooAKKKKACiiigAoopaAEooooAKKKWgBKKKO9ABRRRQAUUUtACUUUtACUUUUAFGaKKACilpKACg0daO9ABijrRRQAtJRRQAUUUUAFFFFAAaKKKADFFFFAB1oooFABRRRQAtJS0lABR0ozRQAtJR3ooAKKWkoAMUUUUAFFFFAB1oxRRQAUUUUALSUUUAFFFFABRS0lABRRRQAUUUUAFFFFABRRRQAUYoooAKWkpaAEooooAKKKKACiiigAooNFABiiiloASiiigAooooAKKKKAA0UUUABo60UYoAKKWkoAKKKKADtRRQaACiiloASgUUUAFFFFABRRS9KAEooNFABRRRQAUdaKKACiiigAooxRQAUUUUALSUUCgAoopaAEpaSigAooooAKKKKACjvRRQAUUUUAFFFFABQaKWgBKKKO9ABRR2ooAWkoooAKKKKAFpKKKACiiigA60UUUAFFFLQAUlFFABRRQaACiiigBaTFFLQAlFFFABRRRQAUUUUAFFLSUAFFFFABS0lFABRRRQAYoNFFABRRRQAUUtJQAUUtJmgD/2Q==",
|
50 |
-
"text/plain": [
|
51 |
-
"<IPython.core.display.Image object>"
|
52 |
-
]
|
53 |
-
},
|
54 |
-
"execution_count": 1,
|
55 |
-
"metadata": {},
|
56 |
-
"output_type": "execute_result"
|
57 |
-
}
|
58 |
-
],
|
59 |
-
"source": [
|
60 |
-
"import bpy\n",
|
61 |
-
"import tempfile\n",
|
62 |
-
"import molecularnodes as mn\n",
|
63 |
-
"\n",
|
64 |
-
"import bpy\n",
|
65 |
-
"import tempfile\n",
|
66 |
-
"from math import pi\n",
|
67 |
-
"\n",
|
68 |
-
"def generate():\n",
|
69 |
-
"\n",
|
70 |
-
" for obj in bpy.context.scene.objects:\n",
|
71 |
-
" if obj.type == 'MESH':\n",
|
72 |
-
" bpy.data.objects.remove(obj, do_unlink=True)\n",
|
73 |
-
"\n",
|
74 |
-
"\n",
|
75 |
-
" molecule = mn.load.molecule_rcsb(\"7TYG\", starting_style=\"cartoon\", center_molecule=True)\n",
|
76 |
-
" molecule.select_set(True)\n",
|
77 |
-
"\n",
|
78 |
-
" bpy.ops.view3d.camera_to_view_selected()\n",
|
79 |
-
" camera = bpy.data.objects[\"Camera\"]\n",
|
80 |
-
" camera.data.dof.use_dof = True\n",
|
81 |
-
" camera.data.dof.focus_distance = 5\n",
|
82 |
-
" camera.data.dof.aperture_fstop = 4\n",
|
83 |
-
" camera.data.angle = pi / 3\n",
|
84 |
-
" camera.data.type = \"PERSP\"\n",
|
85 |
-
"\n",
|
86 |
-
" with tempfile.NamedTemporaryFile(suffix=\".JPEG\", delete=False) as f:\n",
|
87 |
-
" bpy.context.scene.render.resolution_y = 288\n",
|
88 |
-
" bpy.context.scene.render.resolution_x = 512\n",
|
89 |
-
" bpy.context.scene.render.image_settings.file_format = \"JPEG\"\n",
|
90 |
-
" bpy.context.scene.render.filepath = f.name\n",
|
91 |
-
" bpy.context.scene.frame_set(1)\n",
|
92 |
-
" bpy.context.scene.frame_current = 1\n",
|
93 |
-
" bpy.ops.render.render(animation=False, write_still=True)\n",
|
94 |
-
"\n",
|
95 |
-
" bpy.data.images[\"Render Result\"].save_render(\n",
|
96 |
-
" filepath=bpy.context.scene.render.filepath\n",
|
97 |
-
" )\n",
|
98 |
-
" bpy.app.handlers.render_stats.clear()\n",
|
99 |
-
" return f.name\n",
|
100 |
-
"\n",
|
101 |
-
"\n",
|
102 |
-
"from IPython.display import Image\n",
|
103 |
-
"Image(generate())"
|
104 |
-
]
|
105 |
-
},
|
106 |
-
{
|
107 |
-
"cell_type": "code",
|
108 |
-
"execution_count": 2,
|
109 |
-
"metadata": {},
|
110 |
-
"outputs": [
|
111 |
-
{
|
112 |
-
"data": {
|
113 |
-
"application/vnd.jupyter.widget-view+json": {
|
114 |
-
"model_id": "e5740872b66541d18a024ae31b57becf",
|
115 |
-
"version_major": 2,
|
116 |
-
"version_minor": 0
|
117 |
-
},
|
118 |
-
"text/html": [
|
119 |
-
"Cannot show widget. You probably want to rerun the code cell above (<i>Click in the code cell, and press Shift+Enter <kbd>β§</kbd>+<kbd>β©</kbd></i>)."
|
120 |
-
],
|
121 |
-
"text/plain": [
|
122 |
-
"Cannot show ipywidgets in text"
|
123 |
-
]
|
124 |
-
},
|
125 |
-
"metadata": {},
|
126 |
-
"output_type": "display_data"
|
127 |
-
},
|
128 |
-
{
|
129 |
-
"name": "stdout",
|
130 |
-
"output_type": "stream",
|
131 |
-
"text": [
|
132 |
-
"None\n",
|
133 |
-
"Finsihed opening molecule after 0.1597609999999996 seconds\n",
|
134 |
-
"Adding object to scene.\n",
|
135 |
-
"Added res_id after 0.0002570000000003958 s\n",
|
136 |
-
"Added res_name after 0.01812600000000053 s\n",
|
137 |
-
"Added atomic_number after 0.006369999999999543 s\n",
|
138 |
-
"Added b_factor after 5.100000000002325e-05 s\n",
|
139 |
-
"Added vdw_radii after 0.0065309999999998425 s\n",
|
140 |
-
"Added chain_id after 0.000516000000000183 s\n",
|
141 |
-
"Added entity_id after 0.00023499999999998522 s\n",
|
142 |
-
"Added atom_name after 0.005037999999999876 s\n",
|
143 |
-
"Added lipophobicity after 0.007436999999999472 s\n",
|
144 |
-
"Added charge after 0.007236999999999938 s\n",
|
145 |
-
"Added is_backbone after 0.00047999999999959186 s\n",
|
146 |
-
"Added is_alpha_carbon after 0.0001610000000002998 s\n",
|
147 |
-
"Added is_solvent after 0.0001619999999995514 s\n",
|
148 |
-
"Added is_nucleic after 0.0006459999999997024 s\n",
|
149 |
-
"Added is_peptide after 0.0010190000000003252 s\n",
|
150 |
-
"Added is_hetero after 0.0001120000000005561 s\n",
|
151 |
-
"Added is_carb after 0.000656000000000212 s\n",
|
152 |
-
"Added sec_struct after 0.0031799999999995165 s\n",
|
153 |
-
"Finsihed add object after 0.06568800000000063 seconds\n",
|
154 |
-
"Fra:1 Mem:58.97M (Peak 64.78M) | Time:00:00.01 | Syncing Light\n",
|
155 |
-
"Fra:1 Mem:58.97M (Peak 64.78M) | Time:00:00.01 | Syncing Camera\n",
|
156 |
-
"Fra:1 Mem:58.97M (Peak 64.78M) | Time:00:00.01 | Syncing 7TYG\n",
|
157 |
-
"Fra:1 Mem:70.60M (Peak 73.73M) | Time:00:00.01 | Rendering 1 / 64 samples\n",
|
158 |
-
"Fra:1 Mem:61.22M (Peak 73.73M) | Time:00:00.09 | Rendering 26 / 64 samples\n",
|
159 |
-
"Fra:1 Mem:61.28M (Peak 73.73M) | Time:00:00.16 | Rendering 51 / 64 samples\n",
|
160 |
-
"Fra:1 Mem:61.22M (Peak 73.73M) | Time:00:00.19 | Rendering 64 / 64 samples\n",
|
161 |
-
"Saved: '/var/folders/c3/3bzrl3qx043bknt1ycn3fcym0000gn/T/tmp6sh3rfo0.JPEG'\n",
|
162 |
-
" Time: 00:00.20 (Saving: 00:00.00)\n",
|
163 |
-
"\n",
|
164 |
-
"/var/folders/c3/3bzrl3qx043bknt1ycn3fcym0000gn/T/tmp6sh3rfo0.JPEG\n"
|
165 |
-
]
|
166 |
-
}
|
167 |
-
],
|
168 |
-
"source": [
|
169 |
-
"import solara\n",
|
170 |
-
"from IPython.display import Image, display\n",
|
171 |
-
"\n",
|
172 |
-
"light_position = solara.reactive(3)\n",
|
173 |
-
"do_render = solara.reactive(False)\n",
|
174 |
-
"\n",
|
175 |
-
"@solara.component\n",
|
176 |
-
"def Page():\n",
|
177 |
-
"\n",
|
178 |
-
" def render():\n",
|
179 |
-
" if do_render.value:\n",
|
180 |
-
" return generate()\n",
|
181 |
-
" \n",
|
182 |
-
" result = solara.use_thread(render, [do_render.value])\n",
|
183 |
-
" if not do_render.value:\n",
|
184 |
-
" solara.Button(\"Start Rendering\", on_click=lambda: do_render.set(True))\n",
|
185 |
-
" else:\n",
|
186 |
-
" if result.state == solara.ResultState.RUNNING:\n",
|
187 |
-
" solara.Info(\"Rendering in progress...\")\n",
|
188 |
-
" solara.ProgressLinear()\n",
|
189 |
-
" elif result.state == solara.ResultState.ERROR:\n",
|
190 |
-
" solara.Error(\"Rendering failed!: %s\" % result.error)\n",
|
191 |
-
" elif result.state == solara.ResultState.FINISHED:\n",
|
192 |
-
" with solara.Column():\n",
|
193 |
-
" solara.Success(\"Rendering complete. \")\n",
|
194 |
-
" print(result.value)\n",
|
195 |
-
" # workaround for https://github.com/widgetti/solara/pull/267\n",
|
196 |
-
" if result.value:\n",
|
197 |
-
" solara.Image(result.value)\n",
|
198 |
-
"\n",
|
199 |
-
"Page()"
|
200 |
-
]
|
201 |
-
},
|
202 |
-
{
|
203 |
-
"cell_type": "code",
|
204 |
-
"execution_count": 3,
|
205 |
-
"metadata": {},
|
206 |
-
"outputs": [],
|
207 |
-
"source": [
|
208 |
-
"import sys\n",
|
209 |
-
"import os\n",
|
210 |
-
"\n",
|
211 |
-
"sys.stdout = open(os.devnull, 'w')\n",
|
212 |
-
"sys.stderr = open(os.devnull, 'w')\n"
|
213 |
-
]
|
214 |
-
},
|
215 |
-
{
|
216 |
-
"cell_type": "code",
|
217 |
-
"execution_count": null,
|
218 |
-
"metadata": {},
|
219 |
-
"outputs": [],
|
220 |
-
"source": []
|
221 |
-
}
|
222 |
-
],
|
223 |
-
"metadata": {
|
224 |
-
"kernelspec": {
|
225 |
-
"display_name": ".venv",
|
226 |
-
"language": "python",
|
227 |
-
"name": "python3"
|
228 |
-
},
|
229 |
-
"language_info": {
|
230 |
-
"codemirror_mode": {
|
231 |
-
"name": "ipython",
|
232 |
-
"version": 3
|
233 |
-
},
|
234 |
-
"file_extension": ".py",
|
235 |
-
"mimetype": "text/x-python",
|
236 |
-
"name": "python",
|
237 |
-
"nbconvert_exporter": "python",
|
238 |
-
"pygments_lexer": "ipython3",
|
239 |
-
"version": "3.10.13"
|
240 |
-
}
|
241 |
-
},
|
242 |
-
"nbformat": 4,
|
243 |
-
"nbformat_minor": 2
|
244 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/01_widget.ipynb
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": null,
|
6 |
+
"metadata": {},
|
7 |
+
"outputs": [],
|
8 |
+
"source": [
|
9 |
+
"import bpy\n",
|
10 |
+
"from IPython.display import display\n",
|
11 |
+
"from anywidget_3dviewer import Viewer\n",
|
12 |
+
"import solara\n",
|
13 |
+
"from pathlib import Path\n",
|
14 |
+
"\n",
|
15 |
+
"\n",
|
16 |
+
"def make_gltf_model():\n",
|
17 |
+
" bpy.ops.preferences.addon_enable(module=\"io_scene_gltf2\")\n",
|
18 |
+
" bpy.ops.object.select_all(action=\"DESELECT\")\n",
|
19 |
+
" bpy.ops.object.select_by_type(type=\"MESH\")\n",
|
20 |
+
"\n",
|
21 |
+
" bpy.ops.object.delete()\n",
|
22 |
+
" bpy.ops.mesh.primitive_cube_add(size=2, align=\"WORLD\", location=(0, 1, 1))\n",
|
23 |
+
" cube = bpy.context.active_object\n",
|
24 |
+
" gltf_path = \"./model_cube.gltf\"\n",
|
25 |
+
" bpy.ops.object.select_all(action=\"DESELECT\")\n",
|
26 |
+
" cube.select_set(True)\n",
|
27 |
+
" bpy.ops.export_scene.gltf(\n",
|
28 |
+
" filepath=gltf_path, export_format=\"GLTF_EMBEDDED\", use_selection=True\n",
|
29 |
+
" )\n",
|
30 |
+
" gltf_path = Path() / \"model_cube.gltf\"\n",
|
31 |
+
" data = gltf_path.read_bytes()\n",
|
32 |
+
" gltf_path.unlink()\n",
|
33 |
+
" return data\n",
|
34 |
+
"\n",
|
35 |
+
"\n",
|
36 |
+
"data = make_gltf_model()\n",
|
37 |
+
" \n",
|
38 |
+
"\n",
|
39 |
+
"do_render = solara.reactive(False)\n",
|
40 |
+
"\n",
|
41 |
+
"data = make_gltf_model()\n",
|
42 |
+
"\n",
|
43 |
+
"@solara.component\n",
|
44 |
+
"def Page():\n",
|
45 |
+
"\n",
|
46 |
+
" def render():\n",
|
47 |
+
" if do_render.value:\n",
|
48 |
+
" return data\n",
|
49 |
+
" \n",
|
50 |
+
" result = solara.use_thread(render, [do_render.value])\n",
|
51 |
+
" if not do_render.value:\n",
|
52 |
+
" solara.Button(\"Start Rendering\", on_click=lambda: do_render.set(True), color=\"orange\")\n",
|
53 |
+
" else:\n",
|
54 |
+
" if result.state == solara.ResultState.RUNNING:\n",
|
55 |
+
" solara.Info(\"Rendering in progress...\")\n",
|
56 |
+
" solara.ProgressLinear()\n",
|
57 |
+
" elif result.state == solara.ResultState.ERROR:\n",
|
58 |
+
" solara.Error(\"Rendering failed!: %s\" % result.error)\n",
|
59 |
+
" elif result.state == solara.ResultState.FINISHED:\n",
|
60 |
+
" with solara.Column():\n",
|
61 |
+
" solara.Success(\"Rendering complete. \")\n",
|
62 |
+
" if result.value:\n",
|
63 |
+
" viewer = Viewer(gltf_data=result.value)\n",
|
64 |
+
" solara.FileDownload(data, filename=\"model_cube.gltf\", label=\"Download model_cube.gltf\")\n",
|
65 |
+
"\n",
|
66 |
+
" display(viewer)\n",
|
67 |
+
"Page()"
|
68 |
+
]
|
69 |
+
},
|
70 |
+
{
|
71 |
+
"cell_type": "code",
|
72 |
+
"execution_count": null,
|
73 |
+
"metadata": {},
|
74 |
+
"outputs": [],
|
75 |
+
"source": []
|
76 |
+
}
|
77 |
+
],
|
78 |
+
"metadata": {
|
79 |
+
"kernelspec": {
|
80 |
+
"display_name": ".venv",
|
81 |
+
"language": "python",
|
82 |
+
"name": "python3"
|
83 |
+
},
|
84 |
+
"language_info": {
|
85 |
+
"codemirror_mode": {
|
86 |
+
"name": "ipython",
|
87 |
+
"version": 3
|
88 |
+
},
|
89 |
+
"file_extension": ".py",
|
90 |
+
"mimetype": "text/x-python",
|
91 |
+
"name": "python",
|
92 |
+
"nbconvert_exporter": "python",
|
93 |
+
"pygments_lexer": "ipython3",
|
94 |
+
"version": "3.10.13"
|
95 |
+
}
|
96 |
+
},
|
97 |
+
"nbformat": 4,
|
98 |
+
"nbformat_minor": 2
|
99 |
+
}
|
requirements.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
bpy
|
2 |
solara
|
3 |
-
|
|
|
1 |
bpy
|
2 |
solara
|
3 |
+
anywidget_3dviewer
|