Omnibus commited on
Commit
8cf7460
β€’
1 Parent(s): bc19878

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -11
app.py CHANGED
@@ -27,8 +27,8 @@ def image_objects(image):
27
 
28
  def get_seg(image, object):
29
  image = img_resize(image)
30
-
31
- #blur_image_reverse_mask = blur_image*mask_array_three_channel_invert
32
  seg_box=[]
33
  for i in range(len(pred)):
34
  #object_number = int(object.split('_')[0])
@@ -44,7 +44,8 @@ def get_seg(image, object):
44
  seg_out=segmented_image.astype(np.uint8)
45
  seg_box.append(seg_out)
46
 
47
- return(seg_box)
 
48
 
49
 
50
 
@@ -54,9 +55,8 @@ app = gr.Blocks()
54
  with app:
55
  gr.Markdown(
56
  """
57
- ## Portrait Photo Generator
58
- - Create stunning portrait photos by blurring the background of your selected object.
59
- - Adjust the blurring strength using the slider.
60
  """)
61
  with gr.Row():
62
  with gr.Column():
@@ -75,12 +75,9 @@ with app:
75
  gal1=gr.Gallery(type="filepath").style(grid=4)
76
 
77
  seg_btn.click(get_seg, inputs=[image_input,object_output], outputs=gal1)
78
-
79
 
80
- image_input.change(fn=image_objects,
81
- inputs=image_input,
82
- outputs=object_output
83
- )
84
 
85
 
86
 
 
27
 
28
  def get_seg(image, object):
29
  image = img_resize(image)
30
+ pred = model(image)
31
+ pred_object_list = [str(i)+'_'+x['label'] for i, x in enumerate(pred)]
32
  seg_box=[]
33
  for i in range(len(pred)):
34
  #object_number = int(object.split('_')[0])
 
44
  seg_out=segmented_image.astype(np.uint8)
45
  seg_box.append(seg_out)
46
 
47
+ return(seg_box,gr.Dropdown.update(choices = pred_object_list, interactive = True))
48
+ )
49
 
50
 
51
 
 
55
  with app:
56
  gr.Markdown(
57
  """
58
+ ## Image Dissector
59
+
 
60
  """)
61
  with gr.Row():
62
  with gr.Column():
 
75
  gal1=gr.Gallery(type="filepath").style(grid=4)
76
 
77
  seg_btn.click(get_seg, inputs=[image_input,object_output], outputs=gal1)
78
+ image_input.change(get_seg, inputs=[image_input], outputs=[gal1,object_output])
79
 
80
+ #image_input.change(fn=image_objects,inputs=image_input,outputs=object_output)
 
 
 
81
 
82
 
83