jonathanjordan21 commited on
Commit
1df853a
·
verified ·
1 Parent(s): 086881d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -436,10 +436,14 @@ def respond(
436
 
437
  scores_argsort = scores.argsort(descending=True)
438
 
 
 
 
 
439
  if n_num == 0:
440
- std = scores.std()
441
  else:
442
- std = 0
443
  #[::-1]
444
 
445
  if is_multiple:
@@ -453,7 +457,8 @@ def respond(
453
  request_numbers.append(undetected_code)
454
  else:
455
  for i in scores_argsort:
456
- if scores[scores_argsort[0]] - std <= scores[i]:
 
457
  request_details.append(codes[i][6:])
458
  request_numbers.append(codes[i][:3])
459
  request_scores.append(str( round(scores[i].tolist(), 3) ) )
 
436
 
437
  scores_argsort = scores.argsort(descending=True)
438
 
439
+ # if n_num == 0:
440
+ # std = scores.std()
441
+ # else:
442
+ # std = 0
443
  if n_num == 0:
444
+ w_avg = np.average(scores[scores_argsort].numpy(), weights=range(len(t)))
445
  else:
446
+ w_avg = 9999
447
  #[::-1]
448
 
449
  if is_multiple:
 
457
  request_numbers.append(undetected_code)
458
  else:
459
  for i in scores_argsort:
460
+ # if scores[scores_argsort[0]] - std <= scores[i]:
461
+ if scores[i] > w_avg:
462
  request_details.append(codes[i][6:])
463
  request_numbers.append(codes[i][:3])
464
  request_scores.append(str( round(scores[i].tolist(), 3) ) )