Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -60,19 +60,22 @@ title = st.text_area(label='Title', height=50)
|
|
60 |
abstract = st.text_area(label='Summary', height=150)
|
61 |
|
62 |
if st.button('Start classifier'):
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
-
data = pd.DataFrame({'Categories' : tag, 'Probs' : probs})
|
66 |
-
data = data.sort_values(by='Probs', ascending=False)
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
data_answer = pd.DataFrame({'Categories' : prediction_classes, 'Probs, %' : prediction_probs})
|
74 |
-
|
75 |
-
|
76 |
-
st.pyplot(fig)
|
77 |
-
st.write('top-95%')
|
78 |
-
st.write(data_answer)
|
|
|
60 |
abstract = st.text_area(label='Summary', height=150)
|
61 |
|
62 |
if st.button('Start classifier'):
|
63 |
+
if title == '' and abstract == '':
|
64 |
+
st.markdown("Summary and title are empty")
|
65 |
+
else:
|
66 |
+
prediction_classes, prediction_probs, probs = predict_label(title, abstract, tokenizer, model, inv_map)
|
67 |
+
|
68 |
+
data = pd.DataFrame({'Categories' : tag, 'Probs' : probs})
|
69 |
+
data = data.sort_values(by='Probs', ascending=False)
|
70 |
+
|
71 |
+
fig, ax = plt.subplots()
|
72 |
+
ax.bar(data['Categories'], data['Probs'])
|
73 |
+
ax.bar(prediction_classes, prediction_probs)
|
74 |
+
|
75 |
+
|
76 |
+
data_answer = pd.DataFrame({'Categories' : prediction_classes, 'Probs, %' : prediction_probs})
|
77 |
|
|
|
|
|
78 |
|
79 |
+
st.pyplot(fig)
|
80 |
+
st.write('top-95%')
|
81 |
+
st.write(data_answer)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|