bmay commited on
Commit
4a3e6ef
1 Parent(s): c27bfca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -48,10 +48,16 @@ def run_theia(image):
48
  )
49
 
50
  _, width, _ = theia_decode_results[0].shape
51
- theia_decode_results = (255.0 * theia_decode_results[0]).astype(np.uint8)[:, width // 4:, :]
52
- gt_decode_results = (255.0 * gt_decode_results[0]).astype(np.uint8)[:, width // 4:, :]
 
 
 
 
53
 
54
- return [theia_decode_results, gt_decode_results]
 
 
55
 
56
  with gr.Blocks() as demo:
57
  gr.HTML(load_description("gradio_title.md"))
@@ -60,15 +66,15 @@ with gr.Blocks() as demo:
60
  with gr.Row():
61
  with gr.Column():
62
  gr.Markdown("### Input Image")
63
- input_image = gr.Image(type="pil", label="Input Image")
64
  submit_button = gr.Button("Submit")
65
 
66
  with gr.Column():
67
  gr.Markdown("### Theia Results")
68
- theia_output = gr.Image(label="DINOv2, SAM, Depth Anything", type="numpy")
69
 
70
  gr.Markdown("### Ground Truth")
71
- gt_output = gr.Image(label="DINOv2, SAM, Depth Anything", type="numpy")
72
 
73
  submit_button.click(run_theia, inputs=input_image, outputs=[theia_output, gt_output])
74
 
 
48
  )
49
 
50
  _, width, _ = theia_decode_results[0].shape
51
+ theia_decode_dino = (255.0 * theia_decode_results[0]).astype(np.uint8)[:, width // 4 : 2 * width // 4, :]
52
+ theia_decode_sam = (255.0 * theia_decode_results[0]).astype(np.uint8)[:, 2 * width // 4 : 3 * width // 4, :]
53
+ theia_decode_depth = (255.0 * theia_decode_results[0]).astype(np.uint8)[:, 3 * width // 4 :, :]
54
+ gt_dino = (255.0 * theia_decode_results[0]).astype(np.uint8)[:, width // 4 : 2 * width // 4, :]
55
+ gt_sam = (255.0 * theia_decode_results[0]).astype(np.uint8)[:, 2 * width // 4 : 3 * width // 4, :]
56
+ gt_depth = (255.0 * theia_decode_results[0]).astype(np.uint8)[:, 3 * width // 4 :, :]
57
 
58
+ theia_output = [(theia_decode_dino, "DINOv2"), (theia_decode_sam, "SAM"), (theia_decode_depth, "Depth-Anything")]
59
+ gt_output = [(gt_dino, "DINOv2"), (gt_sam, "SAM"), (gt_depth, "Depth-Anything")]
60
+ return theia_output, gt_output
61
 
62
  with gr.Blocks() as demo:
63
  gr.HTML(load_description("gradio_title.md"))
 
66
  with gr.Row():
67
  with gr.Column():
68
  gr.Markdown("### Input Image")
69
+ input_image = gr.Image(type="pil", label=None)
70
  submit_button = gr.Button("Submit")
71
 
72
  with gr.Column():
73
  gr.Markdown("### Theia Results")
74
+ theia_output = gr.Gallery(label=None, type="numpy")
75
 
76
  gr.Markdown("### Ground Truth")
77
+ gt_output = gr.Gallery(label=None, type="numpy")
78
 
79
  submit_button.click(run_theia, inputs=input_image, outputs=[theia_output, gt_output])
80