|
import streamlit as st |
|
from detoxify import Detoxify |
|
|
|
|
|
st.title("Clean Chat Control") |
|
|
|
|
|
input_text = st.text_area('Enter a sentence') |
|
|
|
|
|
if input_text: |
|
|
|
if st.button("Rate Toxicity!"): |
|
|
|
with st.spinner("Crunching numbers..."): |
|
results = Detoxify('original').predict(input_text) |
|
|
|
|
|
st.header("Moderation Results:") |
|
st.write("Toxicity: {:.2f}".format(results['toxicity'])) |
|
st.write("Severe Toxicity: {:.2f}".format(results['severe_toxicity'])) |
|
st.write("Obscene: {:.2f}".format(results['obscene'])) |
|
st.write("Threat: {:.2f}".format(results['threat'])) |
|
st.write("Insult: {:.2f}".format(results['insult'])) |
|
st.write("Identity Attack: {:.2f}".format(results['identity_attack'])) |
|
|
|
|
|
st.markdown(""" |
|
This simple app helps you analyze the content of a sentence for toxicity, threats, and insults. |
|
Enter a sentence in the text box above and click the "Moderate" button to see the results. |
|
""") |
|
|
|
|
|
st.markdown(""" |
|
--- |
|
Created with ❤️ by Joas |
|
""") |
|
|