Gregoryjr commited on
Commit
a169dec
·
unverified ·
1 Parent(s): 64d7ac2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -4,7 +4,7 @@ from transformers import AutoTokenizer, AutoModelForSequenceClassification
4
 
5
  st.title("Milestone #2 offensive statement prediction with pre-trained models")
6
  st.write("in this basic demo you can select a model to judge whether or not the text below is offensive")
7
- text = "The mail man looks soo dumb"
8
  st.write(text)
9
 
10
  options = ["zero-shot-classification", "cardiffnlp/twitter-roberta-base-offensive", "Greys/milestonemodel"]
@@ -38,16 +38,13 @@ if con:
38
  return probs.detach().numpy()[0]
39
  probs = classify_sentence(text)
40
  def find_largest_number(numbers):
41
- if len(numbers) == 0:
42
- print("List is empty.")
43
- return None
44
- max_num = numbers[0]
45
- max_index = 0
46
- for i in range(1, len(numbers)):
47
  if numbers[i] > max_num:
48
- max_num = numbers[i]
49
- max_index = i
50
- return max_index
51
 
52
  print(probs)
53
  index = find_largest_number(probs)
 
4
 
5
  st.title("Milestone #2 offensive statement prediction with pre-trained models")
6
  st.write("in this basic demo you can select a model to judge whether or not the text below is offensive")
7
+ text = "The mail man looks s0oo dumb"
8
  st.write(text)
9
 
10
  options = ["zero-shot-classification", "cardiffnlp/twitter-roberta-base-offensive", "Greys/milestonemodel"]
 
38
  return probs.detach().numpy()[0]
39
  probs = classify_sentence(text)
40
  def find_largest_number(numbers):
41
+ max_num = numbers[0]
42
+ max_index = 0
43
+ for i in range(1, len(numbers)):
 
 
 
44
  if numbers[i] > max_num:
45
+ max_num = numbers[i]
46
+ max_index = i
47
+ return max_index
48
 
49
  print(probs)
50
  index = find_largest_number(probs)