Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -297,7 +297,7 @@ def get_mesh(image, depth, blur_data, loadall):
|
|
297 |
#mesh = trimesh.Trimesh(vertices=verts, faces=triangles, vertex_colors=colors)
|
298 |
mesh.append(trimesh.PointCloud(verts, colors=clrs))
|
299 |
mesh[len(mesh)-1].merge_vertices()
|
300 |
-
mesh[len(mesh)-1].metadata = { "lat": locations[fnum]["lat"], "lng": locations[fnum]["lng"], "heading": locations[fnum]["heading"], "pitch": locations[fnum]["pitch"] }
|
301 |
|
302 |
#theta = locations[fnum]["heading"] / 180 * np.pi
|
303 |
#phi = locations[fnum]["pitch"] / 180 * np.pi
|
@@ -435,6 +435,12 @@ def draw_mask(l, t, v, d, evt: gr.EventData):
|
|
435 |
return gr.ImageEditor(value=d)
|
436 |
|
437 |
|
|
|
|
|
|
|
|
|
|
|
|
|
438 |
css = """
|
439 |
#img-display-container {
|
440 |
max-height: 100vh;
|
@@ -529,6 +535,8 @@ with gr.Blocks(css=css) as demo:
|
|
529 |
processed_video = gr.Video(label="Output Video", format="mp4")
|
530 |
processed_zip = gr.File(label="Output Archive")
|
531 |
result = gr.Model3D(label="3D Mesh", clear_color=[0.5, 0.5, 0.5, 0.0], camera_position=[0, 90, 0], interactive=True, elem_id="model3D")
|
|
|
|
|
532 |
result_file = gr.File(label="3D file (.glb)")
|
533 |
svg_in = gr.HTML(value="""<svg id='svg_in' height='32' width='256' viewBox='0 0 256 32' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' style='touch-action:none;background-color:#808080;' onpointerdown='
|
534 |
try{
|
|
|
297 |
#mesh = trimesh.Trimesh(vertices=verts, faces=triangles, vertex_colors=colors)
|
298 |
mesh.append(trimesh.PointCloud(verts, colors=clrs))
|
299 |
mesh[len(mesh)-1].merge_vertices()
|
300 |
+
mesh[len(mesh)-1].metadata['extras'] = { "lat": locations[fnum]["lat"], "lng": locations[fnum]["lng"], "heading": locations[fnum]["heading"], "pitch": locations[fnum]["pitch"] }
|
301 |
|
302 |
#theta = locations[fnum]["heading"] / 180 * np.pi
|
303 |
#phi = locations[fnum]["pitch"] / 180 * np.pi
|
|
|
435 |
return gr.ImageEditor(value=d)
|
436 |
|
437 |
|
438 |
+
on_load="""
|
439 |
+
async()=>{
|
440 |
+
alert("HELLO");
|
441 |
+
}
|
442 |
+
"""
|
443 |
+
|
444 |
css = """
|
445 |
#img-display-container {
|
446 |
max-height: 100vh;
|
|
|
535 |
processed_video = gr.Video(label="Output Video", format="mp4")
|
536 |
processed_zip = gr.File(label="Output Archive")
|
537 |
result = gr.Model3D(label="3D Mesh", clear_color=[0.5, 0.5, 0.5, 0.0], camera_position=[0, 90, 0], interactive=True, elem_id="model3D")
|
538 |
+
result.change(_js=on_load)
|
539 |
+
result.load(_js=on_load)
|
540 |
result_file = gr.File(label="3D file (.glb)")
|
541 |
svg_in = gr.HTML(value="""<svg id='svg_in' height='32' width='256' viewBox='0 0 256 32' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' style='touch-action:none;background-color:#808080;' onpointerdown='
|
542 |
try{
|