Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -68,7 +68,8 @@ def inference(query, model="miread_contrastive"):
|
|
| 68 |
min_score = min(scores)
|
| 69 |
max_score = max(scores)
|
| 70 |
def normaliser(x): return round(1 - (x-min_score)/max_score, 3)
|
| 71 |
-
|
|
|
|
| 72 |
doc = match[0]
|
| 73 |
score = round(normaliser(round(match[1].item(), 3)), 3)
|
| 74 |
title = doc.metadata['title']
|
|
@@ -77,14 +78,14 @@ def inference(query, model="miread_contrastive"):
|
|
| 77 |
link = doc.metadata.get('link', 'None')
|
| 78 |
|
| 79 |
# For authors
|
| 80 |
-
record = [
|
| 81 |
-
score,
|
| 82 |
author,
|
| 83 |
title,
|
| 84 |
link,
|
| 85 |
date]
|
| 86 |
if auth_counts.get(author, 0) < 2:
|
| 87 |
-
n_table.append(record)
|
|
|
|
| 88 |
if auth_counts.get(author, 0) == 0:
|
| 89 |
auth_counts[author] = 1
|
| 90 |
else:
|
|
|
|
| 68 |
min_score = min(scores)
|
| 69 |
max_score = max(scores)
|
| 70 |
def normaliser(x): return round(1 - (x-min_score)/max_score, 3)
|
| 71 |
+
i = 1
|
| 72 |
+
for match in matches:
|
| 73 |
doc = match[0]
|
| 74 |
score = round(normaliser(round(match[1].item(), 3)), 3)
|
| 75 |
title = doc.metadata['title']
|
|
|
|
| 78 |
link = doc.metadata.get('link', 'None')
|
| 79 |
|
| 80 |
# For authors
|
| 81 |
+
record = [score,
|
|
|
|
| 82 |
author,
|
| 83 |
title,
|
| 84 |
link,
|
| 85 |
date]
|
| 86 |
if auth_counts.get(author, 0) < 2:
|
| 87 |
+
n_table.append([i,]+record)
|
| 88 |
+
i += 1
|
| 89 |
if auth_counts.get(author, 0) == 0:
|
| 90 |
auth_counts[author] = 1
|
| 91 |
else:
|