Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -110,12 +110,13 @@ if st.button("Посмотреть топ"):
|
|
| 110 |
|
| 111 |
ans = model(ids.unsqueeze(0), mask.unsqueeze(0), token_type_ids.unsqueeze(0))
|
| 112 |
elems = [el.item() for el in ans[0].argsort(descending=True)]
|
| 113 |
-
probs = ans[0].softmax(dim=0)
|
| 114 |
str_ans = ''
|
| 115 |
current_prob = 0
|
| 116 |
current_elems = []
|
| 117 |
current_probs = []
|
| 118 |
idx = 0
|
|
|
|
| 119 |
while current_prob < 0.95 and idx < len(elems):
|
| 120 |
current_elems.append(idx_to_tag[elems[idx]])
|
| 121 |
current_probs.append(probs[elems[idx]])
|
|
|
|
| 110 |
|
| 111 |
ans = model(ids.unsqueeze(0), mask.unsqueeze(0), token_type_ids.unsqueeze(0))
|
| 112 |
elems = [el.item() for el in ans[0].argsort(descending=True)]
|
| 113 |
+
probs = ans[0].softmax(dim=0).detach().numpy()
|
| 114 |
str_ans = ''
|
| 115 |
current_prob = 0
|
| 116 |
current_elems = []
|
| 117 |
current_probs = []
|
| 118 |
idx = 0
|
| 119 |
+
|
| 120 |
while current_prob < 0.95 and idx < len(elems):
|
| 121 |
current_elems.append(idx_to_tag[elems[idx]])
|
| 122 |
current_probs.append(probs[elems[idx]])
|