Spaces:
Runtime error
Runtime error
JulianHame
commited on
Commit
•
7109efa
1
Parent(s):
f8d42f6
Update app.py
Browse files
app.py
CHANGED
@@ -8,16 +8,14 @@ from tensorflow import keras
|
|
8 |
|
9 |
model = tf.keras.models.load_model('toxicity_model.h5')
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
y = df[df.columns[2:]].values
|
14 |
|
15 |
-
|
16 |
-
vectorizer = TextVectorization(max_tokens=MAX_FEATURES,
|
17 |
output_sequence_length=1800,
|
18 |
output_mode='int')
|
19 |
|
20 |
-
vectorizer.adapt(
|
21 |
|
22 |
st.title('Toxicity Classifier')
|
23 |
|
@@ -52,10 +50,7 @@ if(identity_hate > highest_class_rating):
|
|
52 |
highest_class_rating = identity_hate
|
53 |
|
54 |
st.write("---")
|
55 |
-
st.write("
|
56 |
-
st.write(toxicity)
|
57 |
st.write("---")
|
58 |
-
st.write("Highest
|
59 |
-
st.write(
|
60 |
-
st.write("Rating:")
|
61 |
-
st.write(highest_class_rating)
|
|
|
8 |
|
9 |
model = tf.keras.models.load_model('toxicity_model.h5')
|
10 |
|
11 |
+
dataset = pd.read_csv('train.csv')
|
12 |
+
comments = dataset['comment_text']
|
|
|
13 |
|
14 |
+
vectorizer = TextVectorization(max_tokens = 2500000,
|
|
|
15 |
output_sequence_length=1800,
|
16 |
output_mode='int')
|
17 |
|
18 |
+
vectorizer.adapt(comments.values)
|
19 |
|
20 |
st.title('Toxicity Classifier')
|
21 |
|
|
|
50 |
highest_class_rating = identity_hate
|
51 |
|
52 |
st.write("---")
|
53 |
+
st.write("Overall toxicity rating: " +toxicity)
|
|
|
54 |
st.write("---")
|
55 |
+
st.write("Highest toxicity class:" +highest_class)
|
56 |
+
st.write("Rating:" +highest_class_rating)
|
|
|
|