Update app.py
Browse files
app.py
CHANGED
@@ -19,9 +19,16 @@ with open('chapter_titles.pkl', 'rb') as file:
|
|
19 |
|
20 |
def classify(text):
|
21 |
output = classifier(text, titles_astiko, multi_label=True)
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
# output = output[0:10]
|
24 |
-
return
|
25 |
|
26 |
|
27 |
text = st.text_input('Enter some text:') # Input field for new text
|
|
|
19 |
|
20 |
def classify(text):
|
21 |
output = classifier(text, titles_astiko, multi_label=True)
|
22 |
+
labels = output['labels']
|
23 |
+
scores = output['scores']
|
24 |
+
return_labels = []
|
25 |
+
for i in range(len(scores)):
|
26 |
+
if scores[i] > 0.99:
|
27 |
+
return_labels.append(labels[i])
|
28 |
+
else:
|
29 |
+
break
|
30 |
# output = output[0:10]
|
31 |
+
return return_labels
|
32 |
|
33 |
|
34 |
text = st.text_input('Enter some text:') # Input field for new text
|