jens commited on
Commit
60edd6a
·
1 Parent(s): 185ceb1
Files changed (1) hide show
  1. app.py +17 -15
app.py CHANGED
@@ -37,28 +37,31 @@ with block:
37
  with gr.Column():
38
  input_image = gr.Image(label='Input', type='pil', tool=None) # mirror_webcam = False
39
  sam_encode_btn = gr.Button('Encode', variant='primary')
40
- sam_encode_status = gr.Label('Not encoded yet')
41
  with gr.Row():
42
- prompt_image = gr.Image(label='Segments')
 
 
 
 
 
43
  prompt_lbl_image = gr.AnnotatedImage(label='Segment Labels')
44
  everything_image = gr.AnnotatedImage(label='Everything')
45
-
 
 
46
  with gr.Row():
47
  with gr.Column():
48
  pcl_figure = gr.Model3D(label="3-D Reconstruction", clear_color=[1.0, 1.0, 1.0, 1.0])
49
  with gr.Row():
50
  n_samples = gr.Slider(minimum=1e3, maximum=1e6, step=1e3, default=1e3, label='Number of Samples')
51
  cube_size = gr.Slider(minimum=0.000001, maximum=0.001, step=0.000001, default=0.00001, label='Cube size')
52
- with gr.Row():
53
- selected_masks_image = gr.AnnotatedImage(label='Selected Masks')
54
- with gr.Column(scale=1):
55
- with gr.Row():
56
- point_label_radio = gr.Radio(label='Point Label', choices=[1,0], value=1)
57
- text = gr.Textbox(label='Mask Name')
58
- reset_btn = gr.Button('New Mask')
59
- sam_sgmt_everything_btn = gr.Button('Segment Everything!', variant = 'primary')
60
  sam_decode_btn = gr.Button('Predict using points!', variant = 'primary')
61
- depth_reconstruction_btn = gr.Button('Depth Reconstruction', variant = 'primary')
62
  # components
63
  components = {point_coords, point_labels, image_edit_trigger, masks, cutout_idx, input_image,
64
  point_label_radio, text, reset_btn, sam_sgmt_everything_btn,
@@ -112,9 +115,8 @@ with block:
112
  # encode image on click
113
  sam.encode(inputs[input_image])
114
  print("encoding done")
115
- return {sam_encode_status: 'Image Encoded!',
116
- prompt_image: inputs[input_image]}
117
- sam_encode_btn.click(on_click_sam_encode_btn, components, [sam_encode_status, prompt_image], queue=False)
118
 
119
  def on_click_sam_dencode_btn(inputs):
120
  print("inferencing")
 
37
  with gr.Column():
38
  input_image = gr.Image(label='Input', type='pil', tool=None) # mirror_webcam = False
39
  sam_encode_btn = gr.Button('Encode', variant='primary')
40
+ #sam_encode_status = gr.Label('Not encoded yet')
41
  with gr.Row():
42
+ with gr.Column():
43
+ prompt_image = gr.Image(label='Segments')
44
+ with gr.Row():
45
+ point_label_radio = gr.Radio(label='Point Label', choices=[1,0], value=1)
46
+ text = gr.Textbox(label='Mask Name')
47
+ reset_btn = gr.Button('New Mask')
48
  prompt_lbl_image = gr.AnnotatedImage(label='Segment Labels')
49
  everything_image = gr.AnnotatedImage(label='Everything')
50
+ selected_masks_image = gr.AnnotatedImage(label='Selected Masks')
51
+ sam_sgmt_everything_btn = gr.Button('Segment Everything!', variant = 'primary')
52
+
53
  with gr.Row():
54
  with gr.Column():
55
  pcl_figure = gr.Model3D(label="3-D Reconstruction", clear_color=[1.0, 1.0, 1.0, 1.0])
56
  with gr.Row():
57
  n_samples = gr.Slider(minimum=1e3, maximum=1e6, step=1e3, default=1e3, label='Number of Samples')
58
  cube_size = gr.Slider(minimum=0.000001, maximum=0.001, step=0.000001, default=0.00001, label='Cube size')
59
+ depth_reconstruction_btn = gr.Button('Depth Reconstruction', variant = 'primary')
60
+
61
+
62
+
 
 
 
 
63
  sam_decode_btn = gr.Button('Predict using points!', variant = 'primary')
64
+
65
  # components
66
  components = {point_coords, point_labels, image_edit_trigger, masks, cutout_idx, input_image,
67
  point_label_radio, text, reset_btn, sam_sgmt_everything_btn,
 
115
  # encode image on click
116
  sam.encode(inputs[input_image])
117
  print("encoding done")
118
+ return {prompt_image: inputs[input_image]}
119
+ sam_encode_btn.click(on_click_sam_encode_btn, components, [prompt_image], queue=False)
 
120
 
121
  def on_click_sam_dencode_btn(inputs):
122
  print("inferencing")