Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -78,16 +78,16 @@ model_type = st.radio(
|
|
78 |
def highlight_obscene_words(text, model_type):
|
79 |
if model_type=="FRIDA":
|
80 |
result=model_wrapper(text, model_type)
|
81 |
-
|
82 |
for item in result:
|
83 |
-
if item
|
84 |
st.markdown(
|
85 |
-
"<span style='background:#47916B;'>{}:приемлемо</span>".format(item
|
86 |
unsafe_allow_html=True
|
87 |
)
|
88 |
else:
|
89 |
st.markdown(
|
90 |
-
"<span style='background:#ffcccc;'>{}:токсично</span>".format(item
|
91 |
unsafe_allow_html=True
|
92 |
)
|
93 |
else:
|
|
|
78 |
def highlight_obscene_words(text, model_type):
|
79 |
if model_type=="FRIDA":
|
80 |
result=model_wrapper(text, model_type)
|
81 |
+
result=result.predictions
|
82 |
for item in result:
|
83 |
+
if item.label=="non-toxic":
|
84 |
st.markdown(
|
85 |
+
"<span style='background:#47916B;'>{}:приемлемо</span>".format(item.text),
|
86 |
unsafe_allow_html=True
|
87 |
)
|
88 |
else:
|
89 |
st.markdown(
|
90 |
+
"<span style='background:#ffcccc;'>{}:токсично</span>".format(item.text),
|
91 |
unsafe_allow_html=True
|
92 |
)
|
93 |
else:
|