from transformers import pipeline import streamlit as st def bias_evaluation_presentation(): st.title("A brief note on Bias and evaluation") st.subheader("You can check yourself if the model is biased or toxic !") st.markdown(""" ### Evaluate a generated content """) def toxicity_classif(text): model_path = "citizenlab/distilbert-base-multilingual-cased-toxicity" toxicity_classifier = pipeline("text-classification", model=model_path, tokenizer=model_path, from_pt=True) result = toxicity_classifier(text) st.markdown(f""" ### Result This content is evaluated as {result[0]["label"]} with a score of {result[0]["score"]} """) bias_evaluation_presentation() txt = st.text_area( "Input the generated content here" ) toxicity_classif(txt)