Gregoryjr commited on
Update app.py
Browse files
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
|
| 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 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
max_num = numbers[0]
|
| 45 |
-
max_index = 0
|
| 46 |
-
for i in range(1, len(numbers)):
|
| 47 |
if numbers[i] > max_num:
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 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)
|