Spaces:
Runtime error
Runtime error
Update gradio_demo.py
Browse files- gradio_demo.py +12 -11
gradio_demo.py
CHANGED
@@ -1219,6 +1219,7 @@ with block:
|
|
1219 |
# scale = float(scale)
|
1220 |
|
1221 |
# return mask_mover.create_composite(self.original_bg, x_pos, y_pos, scale)
|
|
|
1222 |
def update_position(background, x_pos, y_pos, scale):
|
1223 |
if background is None:
|
1224 |
return None
|
@@ -1311,20 +1312,20 @@ with block:
|
|
1311 |
fg_local_y = int(new_height/2 + crop_height*padding)
|
1312 |
#cropped_composite = mask_mover.create_composite(crop_region, fg_local_x, fg_local_y, scale)
|
1313 |
|
1314 |
-
|
1315 |
-
# crop_args = list(args)
|
1316 |
-
# crop_args[0] = cropped_composite
|
1317 |
-
# crop_args[1] = crop_region
|
1318 |
-
# crop_args[3] = crop_width
|
1319 |
-
# crop_args[4] = crop_height
|
1320 |
-
# crop_args = crop_args[:-3] # Remove position and scale arguments
|
1321 |
-
|
1322 |
crop_args = list(args)
|
1323 |
-
crop_args[0] =
|
1324 |
-
crop_args[1] = crop_region
|
1325 |
crop_args[3] = crop_width
|
1326 |
crop_args[4] = crop_height
|
1327 |
-
crop_args = crop_args[:-3] #
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1328 |
|
1329 |
# Get relit result
|
1330 |
relit_crop = process_relight_bg(*crop_args)[0]
|
|
|
1219 |
# scale = float(scale)
|
1220 |
|
1221 |
# return mask_mover.create_composite(self.original_bg, x_pos, y_pos, scale)
|
1222 |
+
|
1223 |
def update_position(background, x_pos, y_pos, scale):
|
1224 |
if background is None:
|
1225 |
return None
|
|
|
1312 |
fg_local_y = int(new_height/2 + crop_height*padding)
|
1313 |
#cropped_composite = mask_mover.create_composite(crop_region, fg_local_x, fg_local_y, scale)
|
1314 |
|
1315 |
+
Process the cropped region
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1316 |
crop_args = list(args)
|
1317 |
+
crop_args[0] = cropped_composite
|
1318 |
+
crop_args[1] = crop_region
|
1319 |
crop_args[3] = crop_width
|
1320 |
crop_args[4] = crop_height
|
1321 |
+
crop_args = crop_args[:-3] # Remove position and scale arguments
|
1322 |
+
|
1323 |
+
# crop_args = list(args)
|
1324 |
+
# crop_args[0] = None # or an empty placeholder for fg if needed
|
1325 |
+
# crop_args[1] = crop_region # keep the background as is
|
1326 |
+
# crop_args[3] = crop_width
|
1327 |
+
# crop_args[4] = crop_height
|
1328 |
+
# crop_args = crop_args[:-3] # remove position/scale arguments
|
1329 |
|
1330 |
# Get relit result
|
1331 |
relit_crop = process_relight_bg(*crop_args)[0]
|