Skip to content

Commit 958c103

Browse files
committed
Directory checking
1 parent b55c7da commit 958c103

File tree

7 files changed

+7
-51015
lines changed

7 files changed

+7
-51015
lines changed

api/DataProcesser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ def handle_classify(self, df, classifier):
5353

5454
def get_pipeline(self, model_name):
5555
if model_name=="emotion_pipeline.pkl":
56-
df = pd.read_csv('api/training_df/tweet_emotions.csv')
56+
df = pd.read_csv('src/assets/tweet_emotions.csv')
5757
train_data, test_data, train_target, test_target = train_test_split(df['content'], df['sentiment'], test_size=0.2, shuffle=True)
5858
elif model_name=="hate_speech.pkl":
59-
df = pd.read_csv('api/training_df/nb_hatespeech.csv', sep=';')
59+
df = pd.read_csv('src/assets/nb_hatespeech.csv', sep=';')
6060
train_data, test_data, train_target, test_target = train_test_split(df['comment'], df['isHate'], test_size=0.2, shuffle=True)
6161
elif model_name=="text_classification_pipeline.pkl":
62-
df = pd.read_csv('api/training_df/nb_news.csv')
62+
df = pd.read_csv('src/assets/nb_news.csv')
6363
train_data, test_data, train_target, test_target = train_test_split(df['short_description'], df['category'], test_size=0.2, shuffle=True)
6464
else:
6565
with open(f'api/models/{model_name}', 'rb') as file:

api/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def upload_file():
7777

7878
@app.route('/get-classifiers', methods=["GET"])
7979
def get_classifiers():
80-
print(build_tree('.'))
80+
print(build_tree('../../../'))
8181
classifiers = get_available_classifiers()
8282
return jsonify(classifiers)
8383

api/available_classifiers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ def get_available_classifiers():
44
model_folder = next((folder for folder in ['models', 'api/models', '_internal/models'] if os.path.exists(folder)), None)
55

66
# Verifica se o diretório 'models' existe
7-
if not os.path.exists(model_folder):
7+
if not model_folder:
88
return []
99

1010
# Obtém a lista de arquivos no diretório 'models'

api/training_df/nb_hatespeech.csv

Lines changed: 0 additions & 999 deletions
This file was deleted.

api/training_df/nb_news.csv

Lines changed: 0 additions & 10009 deletions
This file was deleted.

api/training_df/tweet_emotions.csv

Lines changed: 0 additions & 40001 deletions
This file was deleted.

public/electron.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ function startFlaskProcess() {
5252
flaskProcess.stderr.on('data', (data) => {
5353
console.error(`Flask process stderr: ${data}`);
5454
});
55+
5556
} catch (error) {
5657
console.error(`Flask process error: ${error}`);
5758
}
@@ -77,7 +78,7 @@ function createWindow() {
7778
mainWindow.on('closed', function () {
7879
mainWindow = null;
7980
// Kill Flask server when the window is closed
80-
flaskProcess.kill();
81+
flaskProcess.kill('SIGKILL');
8182
});
8283
}
8384

0 commit comments

Comments
 (0)