Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -118,29 +118,29 @@ def classify(df, new_column = True):
|
|
118 |
print(formatted_sentences)
|
119 |
|
120 |
MCTIinput_vector = []
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
return df
|
145 |
|
146 |
def gen_output(data):
|
|
|
118 |
print(formatted_sentences)
|
119 |
|
120 |
MCTIinput_vector = []
|
121 |
+
for sentence in formatted_sentences:
|
122 |
+
aux_vector = []
|
123 |
+
for word in sentence:
|
124 |
+
try:
|
125 |
+
aux_vector.append(reloaded_w2v_model.wv[word])
|
126 |
+
except:
|
127 |
+
aux_vector.append(np.zeros(item_shape))
|
128 |
+
MCTIinput_vector.append(aux_vector)
|
129 |
+
del formatted_sentences
|
130 |
+
|
131 |
+
MCTIinput_padded = pad_sequences(MCTIinput_vector, maxlen=2726, padding='pre')
|
132 |
+
del MCTIinput_vector
|
133 |
+
print("Sentenças com Padding")
|
134 |
+
predictions = reconstructed_model_CNN.predict(MCTIinput_padded)
|
135 |
+
del MCTIinput_padded
|
136 |
+
print(predictions)
|
137 |
+
|
138 |
+
cleaned_up_predictions = []
|
139 |
+
for prediction in predictions:
|
140 |
+
cleaned_up_predictions.append(1 if prediction >= 0.5 else 0);
|
141 |
+
del predictions
|
142 |
+
|
143 |
+
df['classification'] = cleaned_up_predictions
|
144 |
return df
|
145 |
|
146 |
def gen_output(data):
|