Spaces:
Runtime error
Runtime error
Raise gr.Error instead of constructing it (space-doctor run 20260506T125748Z-9fdf4ee4)
Browse files65 unmodified lines666768697071727374757677787980818 unmodified lines9091929394959697989965 unmodified linesdef infer_point(img):if img is None:gr.Error("Please upload an image and select a point.")if img["background"] is None:gr.Error("Please upload an image and select a point.")# background (original image) layers[0] ( point prompt) composite (total image)image = img["background"].convert("RGB")point_prompt = img["layers"][0]total_image = img["composite"]img_arr = np.array(point_prompt)if not np.any(img_arr):gr.Error("Please select a point on top of the image.")else:nonzero_indices = np.nonzero(img_arr)img_arr = np.array(point_prompt)8 unmodified lines# background (original image) layers[0] ( point prompt) composite (total image)image = prompts["image"]if image is None:gr.Error("Please upload an image and draw a box before submitting")points = prompts["points"][0]if points is None:gr.Error("Please draw a box before submitting.")print(points)# x_min = points[0] x_max = points[3] y_min = points[1] y_max = points[4]65 unmodified lines666768697071727374757677787980818 unmodified lines9091929394959697989965 unmodified linesdef infer_point(img):if img is None:raise gr.Error("Please upload an image and select a point.")if img["background"] is None:raise gr.Error("Please upload an image and select a point.")# background (original image) layers[0] ( point prompt) composite (total image)image = img["background"].convert("RGB")point_prompt = img["layers"][0]total_image = img["composite"]img_arr = np.array(point_prompt)if not np.any(img_arr):raise gr.Error("Please select a point on top of the image.")else:nonzero_indices = np.nonzero(img_arr)img_arr = np.array(point_prompt)8 unmodified lines# background (original image) layers[0] ( point prompt) composite (total image)image = prompts["image"]if image is None:raise gr.Error("Please upload an image and draw a box before submitting")points = prompts["points"][0]if points is None:raise gr.Error("Please draw a box before submitting.")print(points)# x_min = points[0] x_max = points[3] y_min = points[1] y_max = points[4]
app.py+5-5