Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -607,7 +607,7 @@ with gr.Blocks(css=css) as demo:
|
|
607 |
with gr.Accordion(label="Locations", open=False):
|
608 |
offset = gr.HTML(value="""<label for='displace'>Displace</label><input id='displace' type='range' style='width:256px;height:1em;' value='0' min='0' max='255' step='1' oninput='
|
609 |
try {
|
610 |
-
var json = JSON.parse(document.getElementById(\"coords\").innerText.
|
611 |
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].position.x = this.value * json[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)].lat;
|
612 |
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].position.z = this.value * json[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)].lng;
|
613 |
} catch(e) {alert(e)}
|
@@ -726,13 +726,13 @@ with gr.Blocks(css=css) as demo:
|
|
726 |
</pre>""")
|
727 |
selected = gr.Number(elem_id="fnum", value=0, minimum=0, maximum=256, interactive=False)
|
728 |
output_frame.select(fn=select_frame, inputs=[output_mask], outputs=[output_mask, selected])
|
729 |
-
example_coords = """
|
730 |
{"lat": -2.0593128411405814e-06, "lng": 7.138250595062345e-07, "heading": 152.70303, "pitch": 2.607833999999997},
|
731 |
{"lat": 1.5397763348801163e-06, "lng": 1.3651150112536925e-06, "heading": 151.12973, "pitch": 2.8672300000000064},
|
732 |
{"lat": -2.1552188087525792e-05, "lng": 1.5591533522041345e-05, "heading": 151.41025, "pitch": 3.4802200000000028},
|
733 |
{"lat": -3.0588534016828817e-06, "lng": 3.549113042566887e-06, "heading": 151.93391, "pitch": 2.843050000000005},
|
734 |
{"lat": 2.513057799546914e-05, "lng": -2.1219586638920873e-05, "heading": 152.95769, "pitch": 4.233024999999998}
|
735 |
-
]
|
736 |
coords = gr.JSON(elem_id="coords", value=example_coords, label="Precise coordinates", show_label=False)
|
737 |
|
738 |
html = gr.HTML(value="""<label for='zoom'>Zoom</label><input id='zoom' type='range' style='width:256px;height:1em;' value='0.8' min='0.157' max='1.57' step='0.001' oninput='
|
|
|
607 |
with gr.Accordion(label="Locations", open=False):
|
608 |
offset = gr.HTML(value="""<label for='displace'>Displace</label><input id='displace' type='range' style='width:256px;height:1em;' value='0' min='0' max='255' step='1' oninput='
|
609 |
try {
|
610 |
+
var json = JSON.parse(document.getElementById(\"coords\").innerText.replace(/\"root=/, \"\").replace(/\]\"/, \"\"));
|
611 |
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].position.x = this.value * json[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)].lat;
|
612 |
BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].position.z = this.value * json[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)].lng;
|
613 |
} catch(e) {alert(e)}
|
|
|
726 |
</pre>""")
|
727 |
selected = gr.Number(elem_id="fnum", value=0, minimum=0, maximum=256, interactive=False)
|
728 |
output_frame.select(fn=select_frame, inputs=[output_mask], outputs=[output_mask, selected])
|
729 |
+
example_coords = """[
|
730 |
{"lat": -2.0593128411405814e-06, "lng": 7.138250595062345e-07, "heading": 152.70303, "pitch": 2.607833999999997},
|
731 |
{"lat": 1.5397763348801163e-06, "lng": 1.3651150112536925e-06, "heading": 151.12973, "pitch": 2.8672300000000064},
|
732 |
{"lat": -2.1552188087525792e-05, "lng": 1.5591533522041345e-05, "heading": 151.41025, "pitch": 3.4802200000000028},
|
733 |
{"lat": -3.0588534016828817e-06, "lng": 3.549113042566887e-06, "heading": 151.93391, "pitch": 2.843050000000005},
|
734 |
{"lat": 2.513057799546914e-05, "lng": -2.1219586638920873e-05, "heading": 152.95769, "pitch": 4.233024999999998}
|
735 |
+
]"""
|
736 |
coords = gr.JSON(elem_id="coords", value=example_coords, label="Precise coordinates", show_label=False)
|
737 |
|
738 |
html = gr.HTML(value="""<label for='zoom'>Zoom</label><input id='zoom' type='range' style='width:256px;height:1em;' value='0.8' min='0.157' max='1.57' step='0.001' oninput='
|