Rob Caamano commited on
Commit
be5dc38
1 Parent(s): 617cbbf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -7
app.py CHANGED
@@ -16,7 +16,7 @@ model_name = ""
16
 
17
  with st.container():
18
  model_name = st.selectbox(
19
- "Select the model you want to use below.",
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
- result_df = pd.DataFrame({
40
- 'Toxic': ['Yes' if results['toxic'] >= 0.5 else 'No'],
41
- 'Classification': [max_class],
42
- 'Probability': [probability]
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)