Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -333,16 +333,38 @@ 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='
|
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.samples=4; 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><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.
|
345 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
'/><span>1.0</span>""")
|
347 |
canvas = gr.HTML(value="<a href='#' onclick=\"var cntxt=document.getElementsByClassName('model3D')[0].getElementsByTagName('canvas')[0].getContext('2d');cntxt.filter = 'blur(10px)';this.innerText=cntxt.filter\">webgl2</a>")
|
348 |
render = gr.Button("Render")
|
|
|
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='
|
|
|
|
|
337 |
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
338 |
BABYLON.Engine.LastCreatedScene.activeCamera.metadata = {
|
339 |
+
hb: null, vb: null,
|
340 |
pipeline: new BABYLON.DefaultRenderingPipeline(\"default\", true, BABYLON.Engine.LastCreatedScene, [BABYLON.Engine.LastCreatedScene.activeCamera])
|
341 |
}
|
342 |
}
|
343 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.samples = 4;
|
344 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.contrast = this.value;
|
345 |
+
this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.contrast;
|
346 |
+
'/><span>1.0</span>""")
|
347 |
+
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='
|
348 |
+
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
349 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.metadata = {
|
350 |
+
hb: null, vb: null,
|
351 |
+
pipeline: new BABYLON.DefaultRenderingPipeline(\"default\", true, BABYLON.Engine.LastCreatedScene, [BABYLON.Engine.LastCreatedScene.activeCamera])
|
352 |
+
}
|
353 |
+
}
|
354 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.samples = 4;
|
355 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure = this.value;
|
356 |
+
this.parentNode.childNodes[2].innerText = BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure;
|
357 |
+
'/><span>1.0</span>""")
|
358 |
+
blur = gr.HTML(value="""<label for='blur'>Blur</label><input id='blur' type='range' style='width:256px;height:1em;' min='0' max='256' step='1' oninput='
|
359 |
+
if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
|
360 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.metadata = {
|
361 |
+
hb: null, vb: null,
|
362 |
+
pipeline: new BABYLON.DefaultRenderingPipeline(\"default\", true, BABYLON.Engine.LastCreatedScene, [BABYLON.Engine.LastCreatedScene.activeCamera])
|
363 |
+
}
|
364 |
+
}
|
365 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.metadata.hb = new BABYLON.BlurPostProcess("Horizontal blur", new BABYLON.Vector2(1.0, 0), this.value, 1.0, BABYLON.Engine.LastCreatedScene.activeCamera);
|
366 |
+
BABYLON.Engine.LastCreatedScene.activeCamera.metadata.vb = new BABYLON.BlurPostProcess("Vertical blur", new BABYLON.Vector2(0, 1.0), this.value, 1.0, BABYLON.Engine.LastCreatedScene.activeCamera);
|
367 |
+
this.parentNode.childNodes[2].innerText = this.value;
|
368 |
'/><span>1.0</span>""")
|
369 |
canvas = gr.HTML(value="<a href='#' onclick=\"var cntxt=document.getElementsByClassName('model3D')[0].getElementsByTagName('canvas')[0].getContext('2d');cntxt.filter = 'blur(10px)';this.innerText=cntxt.filter\">webgl2</a>")
|
370 |
render = gr.Button("Render")
|