Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -243,23 +243,23 @@ async def process_single_dog(image):
|
|
243 |
return explanation, image, buttons[0], buttons[1], buttons[2], gr.update(visible=True), initial_state
|
244 |
|
245 |
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
|
254 |
-
|
255 |
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
|
262 |
-
|
263 |
|
264 |
# for i, (cropped_image, detection_confidence, box) in enumerate(dogs):
|
265 |
# buttons_html = ""
|
|
|
243 |
return explanation, image, buttons[0], buttons[1], buttons[2], gr.update(visible=True), initial_state
|
244 |
|
245 |
|
246 |
+
async def predict(image):
|
247 |
+
if image is None:
|
248 |
+
return "Please upload an image to start.", None, gr.update(visible=False, choices=[]), None
|
249 |
|
250 |
+
try:
|
251 |
+
if isinstance(image, np.ndarray):
|
252 |
+
image = Image.fromarray(image)
|
253 |
|
254 |
+
dogs = await detect_multiple_dogs(image)
|
255 |
|
256 |
+
color_list = ['#FF0000', '#00FF00', '#0000FF', '#FFFF00', '#00FFFF', '#FF00FF', '#800080', '#FFA500']
|
257 |
+
buttons = []
|
258 |
+
annotated_image = image.copy()
|
259 |
+
draw = ImageDraw.Draw(annotated_image)
|
260 |
+
font = ImageFont.load_default()
|
261 |
|
262 |
+
dogs_info = ""
|
263 |
|
264 |
# for i, (cropped_image, detection_confidence, box) in enumerate(dogs):
|
265 |
# buttons_html = ""
|