Ashoka74 commited on
Commit
73324d4
1 Parent(s): dfbe31e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -1
app.py CHANGED
@@ -950,6 +950,21 @@ with block:
950
  placeholder="Enter object classes separated by periods (e.g. 'car . person .')",
951
  value="couch . table ."
952
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
953
  extract_button = gr.Button(value="(Option 2) Remove Background")
954
  with gr.Row():
955
  extracted_objects = gr.Image(type="numpy", label="Extracted Foreground", height=480)
@@ -1004,7 +1019,11 @@ with block:
1004
  inputs=[input_fg, text_prompt],
1005
  outputs=[extracted_objects, extracted_fg]
1006
  )
1007
-
 
 
 
 
1008
  with gr.Tab("Background", visible=False):
1009
  # empty cache
1010
 
@@ -1147,6 +1166,8 @@ with block:
1147
  outputs=[depth_image]
1148
  )
1149
 
 
 
1150
  # def update_position(background, x_pos, y_pos, scale):
1151
  # """Update composite when position changes"""
1152
  # global original_bg
 
950
  placeholder="Enter object classes separated by periods (e.g. 'car . person .')",
951
  value="couch . table ."
952
  )
953
+
954
+ x_slider = gr.Slider(
955
+ minimum=0,
956
+ maximum=1000,
957
+ label="X Position",
958
+ value=500,
959
+ visible=False
960
+ )
961
+ y_slider = gr.Slider(
962
+ minimum=0,
963
+ maximum=1000,
964
+ label="Y Position",
965
+ value=500,
966
+ visible=False
967
+ )
968
  extract_button = gr.Button(value="(Option 2) Remove Background")
969
  with gr.Row():
970
  extracted_objects = gr.Image(type="numpy", label="Extracted Foreground", height=480)
 
1019
  inputs=[input_fg, text_prompt],
1020
  outputs=[extracted_objects, extracted_fg]
1021
  )
1022
+ extract_button.click(
1023
+ fn=extract_foreground,
1024
+ inputs=[input_fg],
1025
+ outputs=[extracted_fg, x_slider, y_slider]
1026
+ )
1027
  with gr.Tab("Background", visible=False):
1028
  # empty cache
1029
 
 
1166
  outputs=[depth_image]
1167
  )
1168
 
1169
+
1170
+
1171
  # def update_position(background, x_pos, y_pos, scale):
1172
  # """Update composite when position changes"""
1173
  # global original_bg