alexabrahall
commited on
Commit
•
d3c2395
1
Parent(s):
f5565b2
Update app/main.py
Browse files- app/main.py +14 -0
app/main.py
CHANGED
@@ -15,6 +15,16 @@ models = {
|
|
15 |
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
|
20 |
def classify_text(text, model):
|
@@ -33,6 +43,9 @@ user_input = st.text_input("")
|
|
33 |
|
34 |
|
35 |
selected_model = st.selectbox("Select Model", options=list(models.keys()))
|
|
|
|
|
|
|
36 |
|
37 |
label_map ={
|
38 |
"LABEL_0": "Not Homotransphobic",
|
@@ -46,6 +59,7 @@ if st.button('Classify'):
|
|
46 |
prediction_raw_text = st.empty()
|
47 |
prediction_text = st.empty()
|
48 |
|
|
|
49 |
loading_text = st.text("Predicting... (if the model has not been used before, this may take a while)")
|
50 |
# Classify the text
|
51 |
prediction = classify_text(user_input, models[selected_model])
|
|
|
15 |
|
16 |
}
|
17 |
|
18 |
+
model_descriptions = {
|
19 |
+
"fBert Convabuse": "This is the model fBert, trained on the conversational abuse public dataset. It is a binary classification model that predicts whether a given text is abusive or not. The model is based on the fBert architecture and was trained using the Sentence Transformers library.",
|
20 |
+
"fBert HTDM": "This is the model fBert, trained on the hate speech public dataset. It is a binary classification model that predicts whether a given text is hate speech or not. The model is based on the fBert architecture and was trained using the Sentence Transformers library.",
|
21 |
+
"hateBert Convabuse": "This is the model hateBert, trained on the conversational abuse public dataset. It is a binary classification model that predicts whether a given text is abusive or not. The model is based on the hateBert architecture and was trained using the Sentence Transformers library.",
|
22 |
+
"hateBert HTDM": "This is the model hateBert, trained on the hate speech public dataset. It is a binary classification model that predicts whether a given text is hate speech or not. The model is based on the hateBert architecture and was trained using the Sentence Transformers library.",
|
23 |
+
"berTweet Convabuse": "This is the model berTweet, trained on the conversational abuse public dataset. It is a binary classification model that predicts whether a given text is abusive or not. The model is based on the berTweet architecture and was trained using the Sentence Transformers library.",
|
24 |
+
"berTweet HTDM": "This is the model berTweet, trained on the hate speech public dataset. It is a binary classification model that predicts whether a given text is hate speech or not. The model is based on the berTweet architecture and was trained using the Sentence Transformers library.",
|
25 |
+
"roberta Convabuse": "This is the model roberta, trained on the conversational abuse public dataset. It is a binary classification model that predicts whether a given text is abusive or not. The model is based on the roberta architecture and was trained using the Sentence Transformers library.",
|
26 |
+
"roberta HTDM": "This is the model roberta, trained on the hate speech public dataset. It is a binary classification model that predicts whether a given text is hate speech or not. The model is based on the roberta architecture and was trained using the Sentence Transformers library.",
|
27 |
+
}
|
28 |
|
29 |
|
30 |
def classify_text(text, model):
|
|
|
43 |
|
44 |
|
45 |
selected_model = st.selectbox("Select Model", options=list(models.keys()))
|
46 |
+
selected_model_description = model_descriptions[selected_model]
|
47 |
+
st.write("Model Description:")
|
48 |
+
st.write(selected_model_description)
|
49 |
|
50 |
label_map ={
|
51 |
"LABEL_0": "Not Homotransphobic",
|
|
|
59 |
prediction_raw_text = st.empty()
|
60 |
prediction_text = st.empty()
|
61 |
|
62 |
+
|
63 |
loading_text = st.text("Predicting... (if the model has not been used before, this may take a while)")
|
64 |
# Classify the text
|
65 |
prediction = classify_text(user_input, models[selected_model])
|