Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -110,6 +110,7 @@ def classify(df, new_column = True):
|
|
110 |
for sentence in sentencesMCTIList_xp8:
|
111 |
formatted_sentences.append(json.loads(sentence.replace("'",'"')))
|
112 |
|
|
|
113 |
words = list(reloaded_w2v_model.wv.vocab)
|
114 |
item_shape = np.shape(reloaded_w2v_model.wv[words[0]])
|
115 |
MCTIinput_vector = []
|
@@ -121,14 +122,20 @@ def classify(df, new_column = True):
|
|
121 |
except:
|
122 |
aux_vector.append(np.zeros(item_shape))
|
123 |
MCTIinput_vector.append(aux_vector)
|
124 |
-
|
125 |
|
126 |
MCTIinput_padded = pad_sequences(MCTIinput_vector, maxlen=2726, padding='pre')
|
|
|
127 |
|
128 |
predictions = reconstructed_model_CNN.predict(MCTIinput_padded)
|
|
|
|
|
|
|
129 |
cleaned_up_predictions = []
|
130 |
for prediction in predictions:
|
131 |
cleaned_up_predictions.append(1 if prediction >= 0.5 else 0);
|
|
|
|
|
132 |
df['classification'] = cleaned_up_predictions
|
133 |
return df
|
134 |
|
|
|
110 |
for sentence in sentencesMCTIList_xp8:
|
111 |
formatted_sentences.append(json.loads(sentence.replace("'",'"')))
|
112 |
|
113 |
+
del sentencesMCTIList_xp8
|
114 |
words = list(reloaded_w2v_model.wv.vocab)
|
115 |
item_shape = np.shape(reloaded_w2v_model.wv[words[0]])
|
116 |
MCTIinput_vector = []
|
|
|
122 |
except:
|
123 |
aux_vector.append(np.zeros(item_shape))
|
124 |
MCTIinput_vector.append(aux_vector)
|
125 |
+
del formatted_sentences
|
126 |
|
127 |
MCTIinput_padded = pad_sequences(MCTIinput_vector, maxlen=2726, padding='pre')
|
128 |
+
del MCTIinput_vector
|
129 |
|
130 |
predictions = reconstructed_model_CNN.predict(MCTIinput_padded)
|
131 |
+
del MCTIinput_padded
|
132 |
+
print(predictions)
|
133 |
+
|
134 |
cleaned_up_predictions = []
|
135 |
for prediction in predictions:
|
136 |
cleaned_up_predictions.append(1 if prediction >= 0.5 else 0);
|
137 |
+
del predictions
|
138 |
+
|
139 |
df['classification'] = cleaned_up_predictions
|
140 |
return df
|
141 |
|