Spaces:
Runtime error
Runtime error
Hong
commited on
Commit
·
dad37af
1
Parent(s):
51cf9a9
Update BART_utils.py
Browse files- BART_utils.py +3 -1
BART_utils.py
CHANGED
|
@@ -7,6 +7,7 @@ import torch
|
|
| 7 |
|
| 8 |
import requests
|
| 9 |
import json
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
|
@@ -44,7 +45,8 @@ def get_prob(sequence, label):
|
|
| 44 |
|
| 45 |
def get_taggs(sequence, labels, thred=0.5):
|
| 46 |
out = []
|
| 47 |
-
for
|
|
|
|
| 48 |
temp = get_prob(sequence, l)
|
| 49 |
if temp >= thred:
|
| 50 |
out.append((l, temp))
|
|
|
|
| 7 |
|
| 8 |
import requests
|
| 9 |
import json
|
| 10 |
+
from stqdm import stqdm
|
| 11 |
|
| 12 |
|
| 13 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
|
|
|
| 45 |
|
| 46 |
def get_taggs(sequence, labels, thred=0.5):
|
| 47 |
out = []
|
| 48 |
+
for i in stqdm(range(len(labels)):
|
| 49 |
+
l = labels[i]
|
| 50 |
temp = get_prob(sequence, l)
|
| 51 |
if temp >= thred:
|
| 52 |
out.append((l, temp))
|