Rob Caamano commited on
Commit
395b5b7
·
unverified ·
1 Parent(s): 2db0396
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -8,7 +8,7 @@ from transformers import pipeline
8
 
9
  st.title("Detecting Toxic Tweets")
10
 
11
- demo = """Your words are like poison. They seep into my mind and make me feel worthless"""
12
 
13
  text = st.text_area("Input text", demo, height=250)
14
 
@@ -31,7 +31,13 @@ input = tokenizer(text, return_tensors="tf")
31
 
32
  if st.button("Submit", type="primary"):
33
  results = clf(text)[0]
34
- max_class = max(results, key=lambda x: x["score"])
 
 
 
 
 
 
35
  tweet_portion = text[:50] + "..." if len(text) > 50 else text
36
 
37
  # Create and display the table
 
8
 
9
  st.title("Detecting Toxic Tweets")
10
 
11
+ demo = """I'm so proud of myself for accomplishing my goals today. #motivation #success"""
12
 
13
  text = st.text_area("Input text", demo, height=250)
14
 
 
31
 
32
  if st.button("Submit", type="primary"):
33
  results = clf(text)[0]
34
+
35
+ if selected_model == "Fine-tuned Toxicity Model":
36
+ max_class = max(results, key=lambda x: x["score"])
37
+ max_class["label"] = max_class["label"].split("_")[-1] # Extract the toxicity class from the label
38
+ else:
39
+ max_class = max(results, key=lambda x: x["score"])
40
+
41
  tweet_portion = text[:50] + "..." if len(text) > 50 else text
42
 
43
  # Create and display the table