Rob Caamano
commited on
Commit
•
be5dc38
1
Parent(s):
617cbbf
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ model_name = ""
|
|
16 |
|
17 |
with st.container():
|
18 |
model_name = st.selectbox(
|
19 |
-
"Select
|
20 |
("RobCaamano/toxicity",),
|
21 |
)
|
22 |
submit = st.button("Submit", type="primary")
|
@@ -36,13 +36,19 @@ if submit:
|
|
36 |
max_class = max(classes, key=classes.get)
|
37 |
probability = classes[max_class]
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
st.table(result_df)
|
46 |
|
47 |
-
expander = st.expander("Raw output")
|
48 |
expander.write(results)
|
|
|
16 |
|
17 |
with st.container():
|
18 |
model_name = st.selectbox(
|
19 |
+
"Select Model",
|
20 |
("RobCaamano/toxicity",),
|
21 |
)
|
22 |
submit = st.button("Submit", type="primary")
|
|
|
36 |
max_class = max(classes, key=classes.get)
|
37 |
probability = classes[max_class]
|
38 |
|
39 |
+
if results['toxic'] >= 0.5:
|
40 |
+
result_df = pd.DataFrame({
|
41 |
+
'Toxic': ['Yes'],
|
42 |
+
'Toxicity Class': [max_class],
|
43 |
+
'Probability': [probability]
|
44 |
+
})
|
45 |
+
else:
|
46 |
+
result_df = pd.DataFrame({
|
47 |
+
'Toxic': ['No'],
|
48 |
+
'Toxicity Class': 'This text is not toxic',
|
49 |
+
})
|
50 |
|
51 |
st.table(result_df)
|
52 |
|
53 |
+
expander = st.expander("View Raw output")
|
54 |
expander.write(results)
|