Skip to content

Commit

Permalink
Directory checking
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaloney111 committed Jun 10, 2024
1 parent b55c7da commit 958c103
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 51,015 deletions.
6 changes: 3 additions & 3 deletions api/DataProcesser.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ def handle_classify(self, df, classifier):

def get_pipeline(self, model_name):
if model_name=="emotion_pipeline.pkl":
df = pd.read_csv('api/training_df/tweet_emotions.csv')
df = pd.read_csv('src/assets/tweet_emotions.csv')
train_data, test_data, train_target, test_target = train_test_split(df['content'], df['sentiment'], test_size=0.2, shuffle=True)
elif model_name=="hate_speech.pkl":
df = pd.read_csv('api/training_df/nb_hatespeech.csv', sep=';')
df = pd.read_csv('src/assets/nb_hatespeech.csv', sep=';')
train_data, test_data, train_target, test_target = train_test_split(df['comment'], df['isHate'], test_size=0.2, shuffle=True)
elif model_name=="text_classification_pipeline.pkl":
df = pd.read_csv('api/training_df/nb_news.csv')
df = pd.read_csv('src/assets/nb_news.csv')
train_data, test_data, train_target, test_target = train_test_split(df['short_description'], df['category'], test_size=0.2, shuffle=True)
else:
with open(f'api/models/{model_name}', 'rb') as file:
Expand Down
2 changes: 1 addition & 1 deletion api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def upload_file():

@app.route('/get-classifiers', methods=["GET"])
def get_classifiers():
print(build_tree('.'))
print(build_tree('../../../'))
classifiers = get_available_classifiers()
return jsonify(classifiers)

Expand Down
2 changes: 1 addition & 1 deletion api/available_classifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def get_available_classifiers():
model_folder = next((folder for folder in ['models', 'api/models', '_internal/models'] if os.path.exists(folder)), None)

# Verifica se o diretório 'models' existe
if not os.path.exists(model_folder):
if not model_folder:
return []

# Obtém a lista de arquivos no diretório 'models'
Expand Down
999 changes: 0 additions & 999 deletions api/training_df/nb_hatespeech.csv

This file was deleted.

10,009 changes: 0 additions & 10,009 deletions api/training_df/nb_news.csv

This file was deleted.

40,001 changes: 0 additions & 40,001 deletions api/training_df/tweet_emotions.csv

This file was deleted.

3 changes: 2 additions & 1 deletion public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function startFlaskProcess() {
flaskProcess.stderr.on('data', (data) => {
console.error(`Flask process stderr: ${data}`);
});

} catch (error) {
console.error(`Flask process error: ${error}`);
}
Expand All @@ -77,7 +78,7 @@ function createWindow() {
mainWindow.on('closed', function () {
mainWindow = null;
// Kill Flask server when the window is closed
flaskProcess.kill();
flaskProcess.kill('SIGKILL');
});
}

Expand Down

0 comments on commit 958c103

Please sign in to comment.