JulianHame commited on
Commit
7109efa
1 Parent(s): f8d42f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -12
app.py CHANGED
@@ -8,16 +8,14 @@ from tensorflow import keras
8
 
9
  model = tf.keras.models.load_model('toxicity_model.h5')
10
 
11
- df = pd.read_csv('train.csv')
12
- X = df['comment_text']
13
- y = df[df.columns[2:]].values
14
 
15
- MAX_FEATURES = 200000
16
- vectorizer = TextVectorization(max_tokens=MAX_FEATURES,
17
  output_sequence_length=1800,
18
  output_mode='int')
19
 
20
- vectorizer.adapt(X.values)
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("Toxicity rating:")
56
- st.write(toxicity)
57
  st.write("---")
58
- st.write("Highest Toxicity Class:")
59
- st.write(highest_class)
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)