DawnC commited on
Commit
0c0eff1
·
verified ·
1 Parent(s): d9da78c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
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
- # 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 = ""
 
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 = ""