Alex Martin commited on
Commit
da0c231
1 Parent(s): bf1a463

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -11,9 +11,9 @@ st.title("Toxic Tweets Sentiment Analysis")
11
  def create_dict(prob, text):
12
  sorted_indices = np.argsort(prob)[-2:]
13
  info = {"text": text,
14
- "toxicity": labels[sorted_indices[1]],
15
  "percentage1": str(round(prob[sorted_indices[1]], 3)),
16
- "obscenity": labels[sorted_indices[0]],
17
  "percentage2": str(round(prob[sorted_indices[0]], 3))}
18
  return info
19
  def get_cats(text):
@@ -30,6 +30,8 @@ def get_cats(text):
30
  words = "Take that, you funking cat-dragon! You smell really bad!"
31
  text = st.text_area("Insert text for analysis below.", words)
32
 
 
 
33
  model_list = ["aim9061/fine-tuned-toxic-tweet-dilbert", "distilbert-base-uncased-finetuned-sst-2-english", "bert-base-cased", "openai/clip-vit-base-patch32", "emilyalsentzer/Bio_ClinicalBERT",
34
  "sentence-transformers/all-mpnet-base-v2", "facebook/bart-large-cnn", "openai/clip-vit-base-patch16", "speechbrain/spkrec-ecapa-voxceleb",
35
  "albert-base-v2"]
 
11
  def create_dict(prob, text):
12
  sorted_indices = np.argsort(prob)[-2:]
13
  info = {"text": text,
14
+ "label1": toxic_tweet_cats[sorted_indices[1]],
15
  "percentage1": str(round(prob[sorted_indices[1]], 3)),
16
+ "label2": toxic_tweet_cats[sorted_indices[0]],
17
  "percentage2": str(round(prob[sorted_indices[0]], 3))}
18
  return info
19
  def get_cats(text):
 
30
  words = "Take that, you funking cat-dragon! You smell really bad!"
31
  text = st.text_area("Insert text for analysis below.", words)
32
 
33
+ toxic_tweet_cats = ["Toxic", "Severe Toxic", "Obscene", "Threat", "Insult", "Identity Hate", "Not Toxic"]
34
+
35
  model_list = ["aim9061/fine-tuned-toxic-tweet-dilbert", "distilbert-base-uncased-finetuned-sst-2-english", "bert-base-cased", "openai/clip-vit-base-patch32", "emilyalsentzer/Bio_ClinicalBERT",
36
  "sentence-transformers/all-mpnet-base-v2", "facebook/bart-large-cnn", "openai/clip-vit-base-patch16", "speechbrain/spkrec-ecapa-voxceleb",
37
  "albert-base-v2"]