Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -115,30 +115,32 @@ def classify(df, new_column = True):
|
|
115 |
print("Transformado em W2V")
|
116 |
words = list(reloaded_w2v_model.wv.vocab)
|
117 |
item_shape = np.shape(reloaded_w2v_model.wv[words[0]])
|
|
|
|
|
118 |
MCTIinput_vector = []
|
119 |
-
for sentence in formatted_sentences:
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
del formatted_sentences
|
128 |
-
|
129 |
-
MCTIinput_padded = pad_sequences(MCTIinput_vector, maxlen=2726, padding='pre')
|
130 |
-
del MCTIinput_vector
|
131 |
-
print("Sentenças com Padding")
|
132 |
-
predictions = reconstructed_model_CNN.predict(MCTIinput_padded)
|
133 |
-
del MCTIinput_padded
|
134 |
-
print(predictions)
|
135 |
-
|
136 |
-
cleaned_up_predictions = []
|
137 |
-
for prediction in predictions:
|
138 |
-
|
139 |
-
del predictions
|
140 |
-
|
141 |
-
df['classification'] = cleaned_up_predictions
|
142 |
return df
|
143 |
|
144 |
def gen_output(data):
|
|
|
115 |
print("Transformado em W2V")
|
116 |
words = list(reloaded_w2v_model.wv.vocab)
|
117 |
item_shape = np.shape(reloaded_w2v_model.wv[words[0]])
|
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):
|