Hancy commited on
Commit
d10ef69
Β·
1 Parent(s): dbc3505
Files changed (2) hide show
  1. app.py +9 -6
  2. app_config.py +7 -4
app.py CHANGED
@@ -50,9 +50,12 @@ with gr.Blocks(css=CSS) as demo:
50
 
51
  with gr.Row():
52
  input_image = gr.Image(label="Input Image", type='numpy', elem_id='img-display-input')
53
- output_image = gr.Image(label="Range Map", elem_id='img-display-output')
 
 
 
54
  raw_file = gr.File(label="Point Cloud (.txt file). Can be viewed through Meshlab")
55
- submit = gr.Button("Submit")
56
 
57
  def on_submit(image):
58
  cond = load_camera(image)
@@ -63,14 +66,14 @@ with gr.Blocks(css=CSS) as demo:
63
 
64
  rgb_img = colorize_depth(img, log_scale=True)
65
 
66
- return [rgb_img, tmp.name]
67
 
68
- submit.click(on_submit, inputs=[input_image], outputs=[output_image, raw_file])
69
 
70
  example_files = sorted(os.listdir('cam_examples'))
71
  example_files = [os.path.join('cam_examples', filename) for filename in example_files]
72
- examples = gr.Examples(examples=example_files, inputs=[input_image], outputs=[output_image, raw_file],
73
- fn=on_submit, cache_examples=True)
74
 
75
  gr.Markdown(FOOTER)
76
 
 
50
 
51
  with gr.Row():
52
  input_image = gr.Image(label="Input Image", type='numpy', elem_id='img-display-input')
53
+ with gr.Column():
54
+ output_image = gr.Image(label="Output Range Map", elem_id='img-display-output')
55
+ output_pcd = gr.Model3D(label="Output Point Cloud", elem_id='pcd-display-output', interactive=False)
56
+
57
  raw_file = gr.File(label="Point Cloud (.txt file). Can be viewed through Meshlab")
58
+ submit = gr.Button("Generate")
59
 
60
  def on_submit(image):
61
  cond = load_camera(image)
 
66
 
67
  rgb_img = colorize_depth(img, log_scale=True)
68
 
69
+ return [rgb_img, pcd, tmp.name]
70
 
71
+ submit.click(on_submit, inputs=[input_image], outputs=[output_image, output_pcd, raw_file])
72
 
73
  example_files = sorted(os.listdir('cam_examples'))
74
  example_files = [os.path.join('cam_examples', filename) for filename in example_files]
75
+ examples = gr.Examples(examples=example_files, inputs=[input_image], outputs=[output_image, output_pcd, raw_file],
76
+ fn=on_submit, cache_examples=False)
77
 
78
  gr.Markdown(FOOTER)
79
 
app_config.py CHANGED
@@ -2,13 +2,16 @@ import torch
2
 
3
  CSS = """
4
  #img-display-container {
5
- max-height: 100vh;
6
  }
7
  #img-display-input {
8
- max-height: 80vh;
9
  }
10
  #img-display-output {
11
- max-height: 80vh;
 
 
 
12
  }
13
  """
14
  DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
@@ -30,4 +33,4 @@ FOOTER = r"""
30
  year={2024}
31
  }
32
  ```
33
- """
 
2
 
3
  CSS = """
4
  #img-display-container {
5
+ max-height: 160vh;
6
  }
7
  #img-display-input {
8
+ max-height: 140vh;
9
  }
10
  #img-display-output {
11
+ max-height: 70vh;
12
+ }
13
+ #pcd-display-output {
14
+ max-height: 70vh;
15
  }
16
  """
17
  DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
 
33
  year={2024}
34
  }
35
  ```
36
+ """