danielHora commited on
Commit
dc3de32
·
1 Parent(s): ee7ed58

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -29,15 +29,20 @@ def object_classify(img):
29
  num_boxes = len(bboxes)
30
  index = 0
31
 
32
- # Draw bounding box for each result
33
  for i in bboxes:
 
34
  if i['label'] == 'apple':
35
  price_total += 25 #pesos? dunno
36
  elif i['label'] == 'bottle':
37
  price_total += 15
38
  elif i['label'] == 'broccoli':
39
  price_total += 100
40
-
 
 
 
 
41
  box = i['box']
42
  #Draw the bounding box
43
  output_image = draw_bounding_box(img, i['score'],i['label'],
@@ -52,6 +57,6 @@ TITLE = 'Object Detection for Effective Self-Checkout in Grocery Shopping [Work
52
  DESCRIPTION = 'A deep learning application using DETR model to reimagine self-checkout stores.'
53
  EXAMPLES = ['ex1.jpg']
54
  interface=gr.Interface(object_classify,
55
- gr.inputs.Image(type = 'pil'),outputs = [gr.outputs.Image(), gr.outputs.Textbox(label='Total Price: ')],
56
  examples = EXAMPLES,title = TITLE, description=DESCRIPTION, allow_flagging="never")
57
  interface.launch()
 
29
  num_boxes = len(bboxes)
30
  index = 0
31
 
32
+ # Draw bounding box for each result and count the price
33
  for i in bboxes:
34
+
35
  if i['label'] == 'apple':
36
  price_total += 25 #pesos? dunno
37
  elif i['label'] == 'bottle':
38
  price_total += 15
39
  elif i['label'] == 'broccoli':
40
  price_total += 100
41
+ elif i['label'] == 'orange':
42
+ price_total += 20
43
+ elif i['label'] == 'banana':
44
+ price_total += 50
45
+
46
  box = i['box']
47
  #Draw the bounding box
48
  output_image = draw_bounding_box(img, i['score'],i['label'],
 
57
  DESCRIPTION = 'A deep learning application using DETR model to reimagine self-checkout stores.'
58
  EXAMPLES = ['ex1.jpg']
59
  interface=gr.Interface(object_classify,
60
+ gr.inputs.Image(type = 'pil'),outputs = [gr.outputs.Image(), gr.outputs.Textbox(label='Total Price: '), gr.outputs.Textbox(label='Total items in cart: ')],
61
  examples = EXAMPLES,title = TITLE, description=DESCRIPTION, allow_flagging="never")
62
  interface.launch()