niulx commited on
Commit
cbca4d6
1 Parent(s): 877fe46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -9
app.py CHANGED
@@ -66,7 +66,7 @@ def run_segmentation_wrapper(image):
66
  print("!!", len(mask_np_list))
67
  max_val = len(mask_np_list)-1
68
  sliderup = gr.Slider(value = 0, minimum=0, maximum=max_val, step=1, interactive=True)
69
- return image, segmentation, mask_np_list, mask_label_list, image, sliderup, sliderup , 'Segmentatin finish.'
70
 
71
 
72
  def transparent_paste_with_mask(backimg, foreimg, mask_np,transparency = 128):
@@ -169,15 +169,10 @@ if os.path.isdir("./example_tmp"):
169
 
170
 
171
 
172
- css = """
173
- #response {
174
- font-size: 25px !important;
175
- }
176
- """
177
 
178
  from segment import run_segmentation
179
 
180
- with gr.Blocks(css=css) as demo:
181
  image = gr.State() # store mask
182
  image_loaded = gr.State()
183
  segmentation = gr.State()
@@ -196,7 +191,7 @@ with gr.Blocks(css=css) as demo:
196
  with gr.Row():
197
  with gr.Column():
198
  canvas = gr.Image(value = "./img.png", type="numpy", label="Draw Mask", show_label=True, height=LENGTH, width=LENGTH, interactive=True)
199
- result_info0 = gr.Text(label="Response", elem_id="response")
200
  segment_button = gr.Button("Run segmentation")
201
 
202
 
@@ -222,7 +217,7 @@ with gr.Blocks(css=css) as demo:
222
  with gr.Tab(label="2 Optimization"):
223
  with gr.Row():
224
  with gr.Column():
225
- result_info = gr.Text(label="Response", elem_id="response")
226
 
227
  opt_flag = gr.State(0)
228
  gr.Markdown("""<p style="text-align: center; font-size: 20px">Optimization settings (SD)</p>""")
 
66
  print("!!", len(mask_np_list))
67
  max_val = len(mask_np_list)-1
68
  sliderup = gr.Slider(value = 0, minimum=0, maximum=max_val, step=1, interactive=True)
69
+ return image, segmentation, mask_np_list, mask_label_list, image, sliderup, sliderup , 'Segmentation finish. Select mask id and move to the next step.'
70
 
71
 
72
  def transparent_paste_with_mask(backimg, foreimg, mask_np,transparency = 128):
 
169
 
170
 
171
 
 
 
 
 
 
172
 
173
  from segment import run_segmentation
174
 
175
+ with gr.Blocks() as demo:
176
  image = gr.State() # store mask
177
  image_loaded = gr.State()
178
  segmentation = gr.State()
 
191
  with gr.Row():
192
  with gr.Column():
193
  canvas = gr.Image(value = "./img.png", type="numpy", label="Draw Mask", show_label=True, height=LENGTH, width=LENGTH, interactive=True)
194
+ result_info0 = gr.Text(label="Response")
195
  segment_button = gr.Button("Run segmentation")
196
 
197
 
 
217
  with gr.Tab(label="2 Optimization"):
218
  with gr.Row():
219
  with gr.Column():
220
+ result_info = gr.Text(label="Response")
221
 
222
  opt_flag = gr.State(0)
223
  gr.Markdown("""<p style="text-align: center; font-size: 20px">Optimization settings (SD)</p>""")