edward2021 commited on
Commit
5ef5f1c
1 Parent(s): ea61502

fix scan id

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -9,7 +9,7 @@ MESH_NAMES = sorted([os.path.splitext(fname)[0] for fname in os.listdir(MESH_DIR
9
 
10
  def change_scene(dropdown_scene: str):
11
  # reset 3D scene and chatbot history
12
- return os.path.join(MESH_DIR, f'{dropdown_scene}.glb')
13
 
14
  with gr.Blocks(title='PQ3D Demo') as demo:
15
  gr.HTML(value="<h1 align='center'>Unifying 3D Vision Language Understanding vis Promptable Queries </h1>")
@@ -40,22 +40,22 @@ with gr.Blocks(title='PQ3D Demo') as demo:
40
  </strong></center>
41
  """
42
  )
 
43
 
44
  dropdown_scene.change(
45
  fn=change_scene,
46
  inputs=[dropdown_scene],
47
- outputs=[model_3d],
48
  queue=False
49
  )
50
-
51
- def inference_wrapper(text):
52
- scan_id = model_3d.value['orig_name'].split('.')[0]
53
  inst_id, response = inference(scan_id, text)
54
  return f"assets/mask/{scan_id}/{scan_id}_obj_{inst_id}.glb", response
55
 
56
  gr.Interface(
57
  fn=inference_wrapper,
58
- inputs=["text"],
59
  outputs=[gr.Model3D(
60
  clear_color=[0.0, 0.0, 0.0, 0.0], camera_position=(80, 100, 6), label="3D Model"), "text"],
61
  examples=[
 
9
 
10
  def change_scene(dropdown_scene: str):
11
  # reset 3D scene and chatbot history
12
+ return os.path.join(MESH_DIR, f'{dropdown_scene}.glb'), dropdown_scene
13
 
14
  with gr.Blocks(title='PQ3D Demo') as demo:
15
  gr.HTML(value="<h1 align='center'>Unifying 3D Vision Language Understanding vis Promptable Queries </h1>")
 
40
  </strong></center>
41
  """
42
  )
43
+ scan_id = gr.Text("scene0050_00", label='scan_id')
44
 
45
  dropdown_scene.change(
46
  fn=change_scene,
47
  inputs=[dropdown_scene],
48
+ outputs=[model_3d, scan_id],
49
  queue=False
50
  )
51
+
52
+ def inference_wrapper(text, scan_id):
 
53
  inst_id, response = inference(scan_id, text)
54
  return f"assets/mask/{scan_id}/{scan_id}_obj_{inst_id}.glb", response
55
 
56
  gr.Interface(
57
  fn=inference_wrapper,
58
+ inputs=["text", scan_id],
59
  outputs=[gr.Model3D(
60
  clear_color=[0.0, 0.0, 0.0, 0.0], camera_position=(80, 100, 6), label="3D Model"), "text"],
61
  examples=[