|
import streamlit as st
|
|
from pipeline.model import MultiTaskModel
|
|
from pipeline.preprocessing import Preprocessor, EMOTION_LABELS, TOXICITY_LABELS
|
|
|
|
|
|
st.title("ChattyTicket Model: Emotion and Toxicity Classification of Valorant chat messages")
|
|
|
|
st.write("""Discover our innovative model designed to tackle toxicity in Valorant, a popular multiplayer game. Leveraging advanced multi-task learning, our model combines Bi-LSTM and BERT architectures for superior performance. This approach enables accurate classification of toxic conversations and emotional content within the game.
|
|
|
|
Key Features:
|
|
- Multi-Task Learning: Simultaneous classification of toxicity and emotion.
|
|
- Bi-LSTM & BERT Integration: Enhanced accuracy with a BERT pre-trained backbone.
|
|
- High Accuracy: 91.81% in toxicity detection and 86.74% in emotion prediction.
|
|
Insights & Impact:
|
|
- Emotional Landscape: Identifies prevalent emotions like anger and instances of cyberbullying.
|
|
- Healthier Communities: Provides insights for fostering positive gaming environments.
|
|
ChattyTicket API:
|
|
- Evaluate chat text for emotion and toxicity with our user-friendly API. Positive user feedback highlights its effectiveness and interactivity, with ongoing improvements based on user input to better handle nuances like sarcasm.
|
|
|
|
Experience the future of online gaming moderation with our model and contribute to a healthier, more enjoyable gaming community.
|
|
"""
|
|
)
|
|
|
|
st.table(
|
|
{
|
|
"Emotion": EMOTION_LABELS,
|
|
"Toxicity": TOXICITY_LABELS,
|
|
}
|
|
)
|
|
|
|
@st.cache_resource
|
|
def loading_model(bert_base):
|
|
if bert_base == "bert-base-uncased":
|
|
print("Loading base model")
|
|
return MultiTaskModel(preprocessor=Preprocessor())
|
|
elif bert_base == "bert-base-multilingual-cased":
|
|
print("Loading multilingual model")
|
|
return MultiTaskModel(is_multilingual=True, preprocessor=Preprocessor(is_multilingual=True))
|
|
else:
|
|
return None
|
|
|
|
def clear():
|
|
loading_model.clear()
|
|
|
|
bert_base = st.selectbox("Select a model", ("bert-base-uncased", "bert-base-multilingual-cased"), placeholder="Select a model", on_change=clear)
|
|
|
|
|
|
model = loading_model(bert_base)
|
|
|
|
|
|
user_input = st.text_input("Enter a Valorant chat message:")
|
|
st.write("You entered:", user_input)
|
|
|
|
prediction = model.predict(user_input)
|
|
emotions, toxicitys = prediction
|
|
decoded = model.decode(prediction)
|
|
|
|
col1, col2 = st.columns(2)
|
|
|
|
with col1:
|
|
st.write(f"The predicted emotion is: {decoded[0][0][0]}" )
|
|
for i, emotion in enumerate(emotions[0]):
|
|
st.write(f"{EMOTION_LABELS[i]}: {(emotion*100):.2f}%")
|
|
st.progress(float(emotion))
|
|
with col2:
|
|
st.write(f"The predicted toxicity is: {decoded[1][0][0]} ")
|
|
for i, toxicity in enumerate(toxicitys[0]):
|
|
st.write(f"{TOXICITY_LABELS[i]}: {(toxicity*100):.2f}%")
|
|
st.progress(float(toxicity))
|
|
|
|
|
|
|