Spaces:
Starting
Starting
Update app.py
Browse files
app.py
CHANGED
@@ -333,9 +333,17 @@ with gr.Blocks(css=css) as demo:
|
|
333 |
result = gr.Model3D(label="3D Mesh", clear_color=[0.5, 0.5, 0.5, 0.0], camera_position=[0, 90, 0])
|
334 |
html = gr.HTML(value="<label for='zoom'>Zoom</label><input id='zoom' type='range' style='width:256px;height:1em;' min='0.157' max='1.57' step='0.001' oninput='BABYLON.Engine.LastCreatedScene.getNodes()[1].material.pointSize=Math.ceil(Math.log2(Math.PI/this.value));BABYLON.Engine.LastCreatedScene.activeCamera.fov=this.value;this.parentNode.childNodes[2].innerText=BABYLON.Engine.LastCreatedScene.activeCamera.fov;'/><span>0.8</span>")
|
335 |
camera = gr.HTML(value="<a href='#' onclick=\"BABYLON.Engine.LastCreatedScene.activeCamera.radius=0;\">reset camera</a>")
|
336 |
-
contrast = gr.HTML(value="<label for='contrast'>Contrast</label><input id='contrast' type='range' style='width:256px;height:1em;' min='0' max='2' step='0.001' oninput='if(!BABYLON.Engine.LastCreatedScene.activeCamera.metadata){BABYLON.Engine.LastCreatedScene.activeCamera.metadata = { pipeline: new BABYLON.DefaultRenderingPipeline(\"default\", true, BABYLON.Engine.LastCreatedScene, [BABYLON.Engine.LastCreatedScene.activeCamera]) }} BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.
|
337 |
-
exposure = gr.HTML(value="<label for='exposure'>Exposure</label><input id='exposure' type='range' style='width:256px;height:1em;' min='0' max='2' step='0.001' oninput='if(!BABYLON.Engine.LastCreatedScene.activeCamera.metadata){BABYLON.Engine.LastCreatedScene.activeCamera.metadata = { pipeline: new BABYLON.DefaultRenderingPipeline(\"default\", true, BABYLON.Engine.LastCreatedScene, [BABYLON.Engine.LastCreatedScene.activeCamera]) }} BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.
|
338 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
canvas = gr.HTML(value="<a href='#' onclick=\"this.innerText=document.getElementsByClassName('model3D')[0].getElementsByTagName('canvas')[0].getContext('webgl2');\">webgl2</a>")
|
340 |
render = gr.Button("Render")
|
341 |
|
|
|
333 |
result = gr.Model3D(label="3D Mesh", clear_color=[0.5, 0.5, 0.5, 0.0], camera_position=[0, 90, 0])
|
334 |
html = gr.HTML(value="<label for='zoom'>Zoom</label><input id='zoom' type='range' style='width:256px;height:1em;' min='0.157' max='1.57' step='0.001' oninput='BABYLON.Engine.LastCreatedScene.getNodes()[1].material.pointSize=Math.ceil(Math.log2(Math.PI/this.value));BABYLON.Engine.LastCreatedScene.activeCamera.fov=this.value;this.parentNode.childNodes[2].innerText=BABYLON.Engine.LastCreatedScene.activeCamera.fov;'/><span>0.8</span>")
|
335 |
camera = gr.HTML(value="<a href='#' onclick=\"BABYLON.Engine.LastCreatedScene.activeCamera.radius=0;\">reset camera</a>")
|
336 |
+
contrast = gr.HTML(value="<label for='contrast'>Contrast</label><input id='contrast' type='range' style='width:256px;height:1em;' min='0' max='2' step='0.001' oninput='if(!BABYLON.Engine.LastCreatedScene.activeCamera.metadata){BABYLON.Engine.LastCreatedScene.activeCamera.metadata = { pipeline: new BABYLON.DefaultRenderingPipeline(\"default\", true, BABYLON.Engine.LastCreatedScene, [BABYLON.Engine.LastCreatedScene.activeCamera]) }} BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.contrast=this.value;this.parentNode.childNodes[2].innerText=BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.contrast;'/><span>1.0</span>")
|
337 |
+
exposure = gr.HTML(value="<label for='exposure'>Exposure</label><input id='exposure' type='range' style='width:256px;height:1em;' min='0' max='2' step='0.001' oninput='if(!BABYLON.Engine.LastCreatedScene.activeCamera.metadata){BABYLON.Engine.LastCreatedScene.activeCamera.metadata = { pipeline: new BABYLON.DefaultRenderingPipeline(\"default\", true, BABYLON.Engine.LastCreatedScene, [BABYLON.Engine.LastCreatedScene.activeCamera]) }} BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure=this.value;this.parentNode.childNodes[2].innerText=BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure;'/><span>1.0</span>")
|
338 |
+
blur = gr.HTML(value="""<label for='blur'>Blur</label><select onchange='BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.depthOfFieldEnabled=true;BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.depthOfFieldBlurLevel=this.value;'><option value='0'>low</option><option value='1'>mid</option><option value='2'>high</option></select><input id='blur' type='range' style='width:256px;height:1em;' min='1' max='256000' step='1000' oninput='
|
339 |
+
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
340 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.metadata = {
|
341 |
+
pipeline: new BABYLON.DefaultRenderingPipeline(\"default\", true, BABYLON.Engine.LastCreatedScene, [BABYLON.Engine.LastCreatedScene.activeCamera])
|
342 |
+
}
|
343 |
+
}
|
344 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.focusDistance = 128000;
|
345 |
+
this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.focusDistance;
|
346 |
+
'/><span>1.0</span>""")
|
347 |
canvas = gr.HTML(value="<a href='#' onclick=\"this.innerText=document.getElementsByClassName('model3D')[0].getElementsByTagName('canvas')[0].getContext('webgl2');\">webgl2</a>")
|
348 |
render = gr.Button("Render")
|
349 |
|