freealise commited on
Commit
31a34eb
1 Parent(s): 763a98d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -550,7 +550,7 @@ def draw_mask(l, t, v, d, evt: gr.EventData):
550
  return gr.ImageEditor(value=d)
551
 
552
 
553
- on_click="""
554
  async(f, c, o, b, p, d, n)=>{
555
  var intv = setInterval(function(){
556
  if (document.getElementById("iframe3D")===null || typeof document.getElementById("iframe3D")==="undefined") {
@@ -1000,7 +1000,7 @@ with gr.Blocks(css=css, js=js) as demo:
1000
  coords = gr.Textbox(elem_id="coords", value=example_coords, label="Coordinates", interactive=False)
1001
  mesh_order = gr.Textbox(elem_id="order", value="", label="Order", interactive=False)
1002
 
1003
- result_file = gr.File(elem_id="file3D", label="3D file (.glb)")
1004
  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='
1005
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
1006
  var evt = document.createEvent(\"Event\");
@@ -1154,8 +1154,8 @@ with gr.Blocks(css=css, js=js) as demo:
1154
  return output_video_path + (json.dumps(locations),)
1155
 
1156
  submit.click(on_submit, inputs=[input_video, model_type, coords], outputs=[processed_video, processed_zip, output_frame, output_mask, coords])
1157
- render.click(None, inputs=[result_file, coords, mesh_order, bgcolor, output_frame, output_mask, selected], outputs=None, js=on_click)
1158
  render.click(partial(get_mesh), inputs=[output_frame, output_mask, blur_in, load_all], outputs=[result, result_file, mesh_order])
 
1159
 
1160
  example_files = os.listdir('examples')
1161
  example_files.sort()
 
550
  return gr.ImageEditor(value=d)
551
 
552
 
553
+ load_model="""
554
  async(f, c, o, b, p, d, n)=>{
555
  var intv = setInterval(function(){
556
  if (document.getElementById("iframe3D")===null || typeof document.getElementById("iframe3D")==="undefined") {
 
1000
  coords = gr.Textbox(elem_id="coords", value=example_coords, label="Coordinates", interactive=False)
1001
  mesh_order = gr.Textbox(elem_id="order", value="", label="Order", interactive=False)
1002
 
1003
+ result_file = gr.File(elem_id="file3D", label="3D file (.ply)")
1004
  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='
1005
  if (!BABYLON.Engine.LastCreatedScene.activeCamera.metadata) {
1006
  var evt = document.createEvent(\"Event\");
 
1154
  return output_video_path + (json.dumps(locations),)
1155
 
1156
  submit.click(on_submit, inputs=[input_video, model_type, coords], outputs=[processed_video, processed_zip, output_frame, output_mask, coords])
 
1157
  render.click(partial(get_mesh), inputs=[output_frame, output_mask, blur_in, load_all], outputs=[result, result_file, mesh_order])
1158
+ result_file.change(None, inputs=[result_file, coords, mesh_order, bgcolor, output_frame, output_mask, selected], outputs=None, js=load_model)
1159
 
1160
  example_files = os.listdir('examples')
1161
  example_files.sort()