Spaces:
Runtime error
Runtime error
blunt-octopus
commited on
Commit
•
b092bf7
1
Parent(s):
fad7f3a
Update app.py
Browse files
app.py
CHANGED
@@ -28,6 +28,10 @@ def load_tags_info():
|
|
28 |
|
29 |
i += 1
|
30 |
|
|
|
|
|
|
|
|
|
31 |
return (tag_to_id, id_to_tag, id_to_description)
|
32 |
|
33 |
tag_to_id, id_to_tag, id_to_description = load_tags_info()
|
@@ -46,6 +50,8 @@ def top_xx(preds, xx=95):
|
|
46 |
result = []
|
47 |
while total < xx / 100:
|
48 |
next_id = tops[0, index].item()
|
|
|
|
|
49 |
total += preds[0, next_id]
|
50 |
index += 1
|
51 |
result.append({'tag': id_to_tag[next_id], 'description': id_to_description[next_id]})
|
|
|
28 |
|
29 |
i += 1
|
30 |
|
31 |
+
tag_to_id['None'] = 155
|
32 |
+
id_to_tag['155'] = 'None'
|
33 |
+
id_to_description['155'] = 'No tag'
|
34 |
+
|
35 |
return (tag_to_id, id_to_tag, id_to_description)
|
36 |
|
37 |
tag_to_id, id_to_tag, id_to_description = load_tags_info()
|
|
|
50 |
result = []
|
51 |
while total < xx / 100:
|
52 |
next_id = tops[0, index].item()
|
53 |
+
if next_id == 155:
|
54 |
+
continue
|
55 |
total += preds[0, next_id]
|
56 |
index += 1
|
57 |
result.append({'tag': id_to_tag[next_id], 'description': id_to_description[next_id]})
|