Skip to content

Commit

Permalink
classifiers treatment and names
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasgabriel18 committed Nov 3, 2023
1 parent 3f0d9ac commit 6988ae0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
10 changes: 3 additions & 7 deletions api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,21 @@
def hello_world():
return jsonify("Hello, world!")


@app.route('/classify', methods=["POST"])
def upload_file():
received_data = request.get_json()

selected_data = received_data.get('data')
selected_classifier = received_data.get('classifier')
selected_classifier = int(received_data.get('classifier'))

print("selected data: ", selected_data)
print("selected classifier: ", selected_classifier)
#print("selected data: ", selected_data)
#print("selected classifier: ", selected_classifier)

df = pd.DataFrame(selected_data, columns=['input_column'])
result = data_processer.handle_classify(df, selected_classifier)

return jsonify({'result': result.to_json()})


@app.route('/nb-news-model', methods=["POST"])
def news_model():
result = data_processer.nb_news_application()
Expand All @@ -55,7 +53,5 @@ def lin_regression_model():
result = data_processer.lin_regression_model()
return jsonify({"result": result.to_json()})



if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True)
7 changes: 4 additions & 3 deletions src/pages/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function Home() {
classifier: selectedClassifier,
})
.catch((error) => {
console.log(error);
console.error(error.response.data);
});

if (response && response.data) {
Expand Down Expand Up @@ -123,8 +123,9 @@ export default function Home() {
<option value="" disabled selected className="placeholder-gray-300">
Selecione um classificador
</option>
<option value="a">Classificador a</option>
<option value="b">Classificador B</option>
<option value="0">Naive-Bayes Emotions</option>
<option value="1">Naive-Bayes News Topics</option>
<option value="2">Linear Regression Emotions</option>
</select>
</div>

Expand Down

0 comments on commit 6988ae0

Please sign in to comment.