Spaces:
Sleeping
Sleeping
jonathanjordan21
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -502,13 +502,15 @@ def respond(
|
|
502 |
scores = cos_sim(codes_emb, text_emb).mean(axis=-1)#[:,0]
|
503 |
|
504 |
scores_argsort = scores.argsort(descending=True)
|
|
|
505 |
|
506 |
# if n_num == 0:
|
507 |
# std = scores.std()
|
508 |
# else:
|
509 |
# std = 0
|
510 |
if n_num == 0:
|
511 |
-
w_avg = np.average(scores[scores_argsort].numpy(), weights=range(len(scores),0,-1))
|
|
|
512 |
else:
|
513 |
w_avg = 9999
|
514 |
#[::-1]
|
|
|
502 |
scores = cos_sim(codes_emb, text_emb).mean(axis=-1)#[:,0]
|
503 |
|
504 |
scores_argsort = scores.argsort(descending=True)
|
505 |
+
weights = [18,8,7,6,5,4,3,2,1]
|
506 |
|
507 |
# if n_num == 0:
|
508 |
# std = scores.std()
|
509 |
# else:
|
510 |
# std = 0
|
511 |
if n_num == 0:
|
512 |
+
# w_avg = np.average(scores[scores_argsort].numpy(), weights=range(len(scores),0,-1))
|
513 |
+
w_avg = np.average(scores[scores_argsort].numpy(), weights=weights)
|
514 |
else:
|
515 |
w_avg = 9999
|
516 |
#[::-1]
|