Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -110,39 +110,43 @@ def classify(df, new_column = True):
|
|
110 |
formatted_sentences = []
|
111 |
for sentence in sentencesMCTIList_xp8:
|
112 |
formatted_sentences.append(json.loads(sentence.replace("'",'"')))
|
113 |
-
del sentencesMCTIList_xp8
|
114 |
-
|
115 |
-
print(
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
print(
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
print(
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
|
|
|
|
|
|
|
|
146 |
return df
|
147 |
|
148 |
def gen_output(data):
|
|
|
110 |
formatted_sentences = []
|
111 |
for sentence in sentencesMCTIList_xp8:
|
112 |
formatted_sentences.append(json.loads(sentence.replace("'",'"')))
|
113 |
+
# del sentencesMCTIList_xp8
|
114 |
+
|
115 |
+
print(sentencesMCTIList_xp8[0])
|
116 |
+
print("##########################")
|
117 |
+
print(formatted_sentences[0])
|
118 |
+
|
119 |
+
# print("Transformado em W2V")
|
120 |
+
# words = list(reloaded_w2v_model.wv.vocab)
|
121 |
+
# item_shape = np.shape(reloaded_w2v_model.wv[words[0]])
|
122 |
+
# # print(formatted_sentences)
|
123 |
+
|
124 |
+
# MCTIinput_vector = []
|
125 |
+
# for sentence in formatted_sentences:
|
126 |
+
# aux_vector = []
|
127 |
+
# for word in sentence:
|
128 |
+
# if word in reloaded_w2v_model.wv.vocab:
|
129 |
+
# aux_vector.append(reloaded_w2v_model.wv[word])
|
130 |
+
# else:
|
131 |
+
# aux_vector.append(np.zeros(item_shape))
|
132 |
+
# MCTIinput_vector.append(aux_vector)
|
133 |
+
# del formatted_sentences
|
134 |
+
# print("Convertido W2V")
|
135 |
+
# MCTIinput_padded = pad_sequences(MCTIinput_vector, maxlen=2726, padding='pre')
|
136 |
+
# del MCTIinput_vector
|
137 |
+
# print("Sentenças com Padding")
|
138 |
+
# print(len(MCTIinput_padded))
|
139 |
+
# print(len(MCTIinput_padded[0]))
|
140 |
+
# predictions = reconstructed_model_CNN.predict(MCTIinput_padded)
|
141 |
+
# del MCTIinput_padded
|
142 |
+
# print(predictions)
|
143 |
+
|
144 |
+
# cleaned_up_predictions = []
|
145 |
+
# for prediction in predictions:
|
146 |
+
# cleaned_up_predictions.append(1 if prediction >= 0.5 else 0);
|
147 |
+
# del predictions
|
148 |
+
|
149 |
+
# df['classification'] = cleaned_up_predictions
|
150 |
return df
|
151 |
|
152 |
def gen_output(data):
|