Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -105,12 +105,14 @@ def pre_process():
|
|
105 |
|
106 |
def classify(df, new_column = True):
|
107 |
sentencesMCTIList_xp8 = df['opo_pre_tkn']
|
|
|
108 |
|
109 |
formatted_sentences = []
|
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 = []
|
@@ -126,7 +128,7 @@ def classify(df, new_column = True):
|
|
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)
|
@@ -153,6 +155,7 @@ reconstructed_model_CNN = keras.models.load_model("best weights CNN.h5",
|
|
153 |
|
154 |
def app(operacao, resultado, dados):
|
155 |
data = pd.read_excel(dados)
|
|
|
156 |
|
157 |
# boxes = {'Color': ['Green','Green','Green','Blue','Blue','Red','Red','Red'],
|
158 |
# 'Shape': ['Rectangle','Rectangle','Square','Rectangle','Square','Square','Square','Rectangle'],
|
@@ -174,6 +177,7 @@ def app(operacao, resultado, dados):
|
|
174 |
|
175 |
return output
|
176 |
elif operacao == "Apenas Classificação" :
|
|
|
177 |
df = classify(data, resultado == "Nova Coluna")
|
178 |
output = gen_output(df)
|
179 |
|
|
|
105 |
|
106 |
def classify(df, new_column = True):
|
107 |
sentencesMCTIList_xp8 = df['opo_pre_tkn']
|
108 |
+
print("Dados da planilha adquiridos")
|
109 |
|
110 |
formatted_sentences = []
|
111 |
for sentence in sentencesMCTIList_xp8:
|
112 |
formatted_sentences.append(json.loads(sentence.replace("'",'"')))
|
|
|
113 |
del sentencesMCTIList_xp8
|
114 |
+
|
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 = []
|
|
|
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)
|
|
|
155 |
|
156 |
def app(operacao, resultado, dados):
|
157 |
data = pd.read_excel(dados)
|
158 |
+
print("Dados Carregados!")
|
159 |
|
160 |
# boxes = {'Color': ['Green','Green','Green','Blue','Blue','Red','Red','Red'],
|
161 |
# 'Shape': ['Rectangle','Rectangle','Square','Rectangle','Square','Square','Square','Rectangle'],
|
|
|
177 |
|
178 |
return output
|
179 |
elif operacao == "Apenas Classificação" :
|
180 |
+
print("Apenas Classificação Selecionado!")
|
181 |
df = classify(data, resultado == "Nova Coluna")
|
182 |
output = gen_output(df)
|
183 |
|