freealise commited on
Commit
953b0fe
1 Parent(s): 202645d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -442,6 +442,14 @@ def draw_mask(l, t, v, d, evt: gr.EventData):
442
  return gr.ImageEditor(value=d)
443
 
444
 
 
 
 
 
 
 
 
 
445
  on_click="""
446
  async()=>{
447
  var intv = setInterval(function(){
@@ -476,7 +484,7 @@ async()=>{
476
 
477
  js = """
478
  async()=>{
479
- alert('Hi');
480
  }
481
  """
482
 
@@ -576,6 +584,7 @@ with gr.Blocks(css=css, js=js) as demo:
576
  processed_zip = gr.File(label="Output Archive")
577
  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")
578
  result_file = gr.File(label="3D file (.glb)")
 
579
  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='
580
  try{
581
  if (document.getElementById(\"pl\").getAttribute(\"points\").slice(0,5) == \"-1,0 \") {
 
442
  return gr.ImageEditor(value=d)
443
 
444
 
445
+ load_model="""
446
+ async(url)=>{
447
+ if (document.getElementById("iframe3D")) {
448
+ document.getElementById("iframe3D").src = "index.htm?url=" + url;
449
+ }
450
+ }
451
+ """
452
+
453
  on_click="""
454
  async()=>{
455
  var intv = setInterval(function(){
 
484
 
485
  js = """
486
  async()=>{
487
+ console.log('Hi');
488
  }
489
  """
490
 
 
584
  processed_zip = gr.File(label="Output Archive")
585
  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")
586
  result_file = gr.File(label="3D file (.glb)")
587
+ result_file.change(fn=None, inputs=[result_file], outputs=[result_file], js=load_model)
588
  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='
589
  try{
590
  if (document.getElementById(\"pl\").getAttribute(\"points\").slice(0,5) == \"-1,0 \") {