freealise commited on
Commit
2b9e0bc
1 Parent(s): 72935c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -319,6 +319,9 @@ def select_frame(v, evt: gr.SelectData):
319
  #print(v)
320
  return v, frame_selected
321
 
 
 
 
322
 
323
  css = """
324
  #img-display-container {
@@ -365,7 +368,8 @@ with gr.Blocks(css=css) as demo:
365
  input_url = gr.Textbox(value="./examples/streetview.mp4", label="URL")
366
  input_video = gr.Video(label="Input Video", format="mp4")
367
  input_url.change(fn=loadurl, inputs=[input_url], outputs=[input_video])
368
- output_frame = gr.Gallery(label="Frames", type='numpy', preview=True, rows=2)
 
369
  output_mask = gr.ImageEditor(interactive=True, transforms=(None,), eraser=gr.Eraser(), brush=gr.Brush(colors=['black', 'darkgray', 'gray', 'lightgray', 'white']), layers=True)
370
  submit = gr.Button("Submit")
371
  with gr.Column():
@@ -614,9 +618,9 @@ with gr.Blocks(css=css) as demo:
614
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure = document.getElementById(\"exposure\").value;
615
 
616
  document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].material.pointSize/2.0*Math.sqrt(2.0) + \"px)\";
617
-
618
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata.gizmoManager) {
619
- BABYLON.Engine.LastCreatedScene.activeCamera.metadata.gizmoManager = new BABYLON.GizmoManager(BABYLON.Engine.LastCreatedScene, 16);
620
 
621
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.gizmoManager.positionGizmoEnabled = true;
622
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.gizmoManager.rotationGizmoEnabled = false;
@@ -641,7 +645,7 @@ with gr.Blocks(css=css) as demo:
641
  }
642
  }
643
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.gizmoManager.attachToMesh(BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1]);
644
-
645
  '>reset camera</a>""")
646
  contrast = gr.HTML(value="""<label for='contrast'>Contrast</label><input id='contrast' type='range' style='width:256px;height:1em;' value='2.0' min='0' max='2' step='0.001' oninput='
647
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
 
319
  #print(v)
320
  return v, frame_selected
321
 
322
+ def align_rows(v):
323
+ global masks
324
+ return gr.Gallery(columns=int(len(masks)/2))
325
 
326
  css = """
327
  #img-display-container {
 
368
  input_url = gr.Textbox(value="./examples/streetview.mp4", label="URL")
369
  input_video = gr.Video(label="Input Video", format="mp4")
370
  input_url.change(fn=loadurl, inputs=[input_url], outputs=[input_video])
371
+ output_frame = gr.Gallery(label="Frames", type='numpy', preview=True, columns=8192)
372
+ output_frame.change(fn=align_rows, inputs=[output_frame], outputs=[output_frame])
373
  output_mask = gr.ImageEditor(interactive=True, transforms=(None,), eraser=gr.Eraser(), brush=gr.Brush(colors=['black', 'darkgray', 'gray', 'lightgray', 'white']), layers=True)
374
  submit = gr.Button("Submit")
375
  with gr.Column():
 
618
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.pipeline.imageProcessing.exposure = document.getElementById(\"exposure\").value;
619
 
620
  document.getElementById(\"model3D\").getElementsByTagName(\"canvas\")[0].style.filter = \"blur(\" + BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1].material.pointSize/2.0*Math.sqrt(2.0) + \"px)\";
621
+ try {
622
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata.gizmoManager) {
623
+ BABYLON.Engine.LastCreatedScene.activeCamera.metadata.gizmoManager = new BABYLON.GizmoManager(BABYLON.Engine.LastCreatedScene, 12);
624
 
625
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.gizmoManager.positionGizmoEnabled = true;
626
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.gizmoManager.rotationGizmoEnabled = false;
 
645
  }
646
  }
647
  BABYLON.Engine.LastCreatedScene.activeCamera.metadata.gizmoManager.attachToMesh(BABYLON.Engine.LastCreatedScene.getNodes()[parseInt(document.getElementById(\"fnum\").getElementsByTagName(\"input\")[0].value)+1]);
648
+ } catch(e) {alert(e)}
649
  '>reset camera</a>""")
650
  contrast = gr.HTML(value="""<label for='contrast'>Contrast</label><input id='contrast' type='range' style='width:256px;height:1em;' value='2.0' min='0' max='2' step='0.001' oninput='
651
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {