Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #27

Merged
merged 30 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
eeeef12
Merge pull request #17 from TailUFPB/main
jonasgabriel18 Apr 6, 2024
457ed95
chore: develop workflow fixed
tahaluh Apr 6, 2024
f7fe2fd
fixed spawn of flask server to work on windows
jonasgabriel18 Apr 12, 2024
91ff7b2
about page. fixes #19
jonasgabriel18 Apr 12, 2024
78c34fb
Merge pull request #21 from TailUFPB/about-page
jonasgabriel18 Apr 14, 2024
31be1c1
release test
jonasgabriel18 Apr 14, 2024
8c5c78f
try to fix develop release autoversion
jonasgabriel18 Apr 14, 2024
13efdcd
try to fix develop release autoversion
jonasgabriel18 Apr 14, 2024
6c2537a
try to fix develop release autoversion
jonasgabriel18 Apr 14, 2024
095f4e6
Delete api/models/Tweet_emotions
cmaloney111 Apr 14, 2024
615a9bb
Delete api/models/IHIJI
cmaloney111 Apr 14, 2024
890c991
Merge pull request #22 from TailUFPB/main
cmaloney111 Apr 14, 2024
b346555
Removing unnecessary code
cmaloney111 Apr 14, 2024
1489f32
add hatespeech classifier
GiseleBr678 Apr 15, 2024
ee50639
Merge pull request #23 from TailUFPB/main
cmaloney111 Apr 15, 2024
900937b
Delete license.md
cmaloney111 Apr 15, 2024
6437dfd
Delete license.md
cmaloney111 Apr 15, 2024
9a83f7c
feat: about updated
tahaluh Apr 15, 2024
ba33b4f
feat: feedback item menu added
tahaluh Apr 15, 2024
9d02dd9
fix: install dependencies uncomented
tahaluh Apr 15, 2024
6778a90
chore: develop workflow version test
tahaluh Apr 15, 2024
48275ff
Merge branch 'develop' into about-page
tahaluh Apr 15, 2024
d3f44cb
Merge pull request #24 from TailUFPB/about-page
tahaluh Apr 15, 2024
bb80df9
chore: license updated
tahaluh Apr 15, 2024
d68bc35
Merge pull request #25 from TailUFPB/about-page
tahaluh Apr 15, 2024
052c74d
chore: main & develop version workflow fixed
tahaluh Apr 15, 2024
352dfcf
Merge pull request #26 from TailUFPB/about-page
tahaluh Apr 15, 2024
22ad50f
chore: workflow version update
tahaluh Apr 15, 2024
8af2fd1
Merge pull request #28 from TailUFPB/about-page
tahaluh Apr 15, 2024
841df2e
chore: test model removed
tahaluh Apr 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,15 @@ jobs:
with:
node-version: "14"

- name: Install Wine
- name: Install Wine64
run: sudo apt update && sudo apt install wine64

- name: Install Wine32
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install wine32

- name: ⬇️ Checkout repo
uses: actions/checkout@v4
with:
Expand All @@ -126,19 +132,24 @@ jobs:

- name: 📦 Electron Builder
run: npm run electron:package:win
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get latest release number
id: get_latest_release
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const response = await github.repos.getLatestRelease({
const response = await github.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo
repo: context.repo.repo,
per_page: 10
});
const latestRelease = response.data.tag_name;
const versionParts = latestRelease.replace(/^v/, '').split('.');

const latestPreRelease = response.data[0];
const preReleaseTag = latestPreRelease.name;
const versionParts = preReleaseTag.replace(/^v/, '').split('.');
const newVersion = `${parseInt(versionParts[0])}.${parseInt(versionParts[1])}.${parseInt(versionParts[2]) + 1}`;
console.log(`::set-output name=new_version::${newVersion}`);

Expand All @@ -152,7 +163,7 @@ jobs:
files: |
./dist/LinguifAI\ Setup\ ${{ steps.get_latest_release.outputs.new_version }}.exe
tag_name: v${{ steps.get_latest_release.outputs.new_version }}
name: Release v${{ steps.get_latest_release.outputs.new_version }}
name: v${{ steps.get_latest_release.outputs.new_version }}
prerelease: true
body: |
Descrição do release aqui
17 changes: 10 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,16 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const response = await github.repos.getLatestRelease({
const response = await github.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo
});
const latestRelease = response.data.tag_name;
const versionParts = latestRelease.replace(/^v/, '').split('.');
const newVersion = `${parseInt(versionParts[0])}.${parseInt(versionParts[1]) + 1}.0`;
repo: context.repo.repo,
per_page: 10
});

const latestPreRelease = response.data[0];
const preReleaseTag = latestPreRelease.name;
const versionParts = preReleaseTag.replace(/^v/, '').split('.');
const newVersion = `${parseInt(versionParts[0])}.${parseInt(versionParts[1])+1}.0`;
console.log(`::set-output name=new_version::${newVersion}`);

- name: Rename file
Expand All @@ -160,7 +163,7 @@ jobs:
files: |
./dist/LinguifAI\ Setup\ ${{ steps.get_latest_release.outputs.new_version }}.exe
tag_name: v${{ steps.get_latest_release.outputs.new_version }}
name: Release v${{ steps.get_latest_release.outputs.new_version }}
name: v${{ steps.get_latest_release.outputs.new_version }}
prerelease: true
body: |
Descrição do release aqui
1 change: 0 additions & 1 deletion api/DataProcesser.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

from NbNewsModel import news_prediction
from NbEmotionsModel import make_prediction
from NbLinRegressionModel import make_prediction_nblin
from available_classifiers import get_available_classifiers

import Neural_Network2
Expand Down
16 changes: 16 additions & 0 deletions api/HateSpeechModel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import pickle

def make_prediction(my_sentence):
model_file = "./models/hate_speech.pkl"
try:
# Carregando o pipeline do arquivo .pkl
with open(model_file, 'rb') as model_file:
pipeline = pickle.load(model_file)

# Fazendo previsões para os textos
predictions = pipeline.predict([my_sentence])

return predictions[0]

except Exception as e:
return str(e)
6 changes: 0 additions & 6 deletions api/NbEmotionsModel.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import pandas as pd
import pickle

# bag of words
from sklearn.feature_extraction.text import TfidfVectorizer

#tfidf_vectorizer = TfidfVectorizer(use_idf=True)

def make_prediction(my_sentence):
model_file = "./models/emotions_pipeline.pkl"
try:
Expand Down
16 changes: 0 additions & 16 deletions api/NbLinRegressionModel.py

This file was deleted.

1 change: 0 additions & 1 deletion api/NbNewsModel.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pandas as pd
import pickle

def news_prediction(texts):
Expand Down
Binary file removed api/models/IHIJI
Binary file not shown.
Binary file added api/models/hate_speech.pkl
Binary file not shown.
9 changes: 6 additions & 3 deletions api/models_code/nb_emotions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import pandas as pd
import pickle
from sklearn.pipeline import make_pipeline
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer

# bag of words
from sklearn.feature_extraction.text import TfidfVectorizer
Expand All @@ -11,7 +9,12 @@
from sklearn.naive_bayes import MultinomialNB

df = pd.read_csv('../training_df/tweet_emotions.csv')
train_data, test_data, train_target, test_target = train_test_split(df["content"], df["sentiment"], test_size=0.2, shuffle=True)

# Dividindo os dados em um conjunto de treinamento e um conjunto de teste
x = df['content']
y = df['sentiment']

train_data, test_data, train_target, test_target = train_test_split(x, y, test_size=0.2, shuffle=True)

# Criando um pipeline com o vetorizador TF-IDF e o classificador Multinomial Naive Bayes
pipeline = make_pipeline(TfidfVectorizer(), MultinomialNB())
Expand Down
27 changes: 27 additions & 0 deletions api/models_code/nb_hatespeech.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import pandas as pd
import pickle
from sklearn.pipeline import make_pipeline

# bag of words
from sklearn.feature_extraction.text import TfidfVectorizer

from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import MultinomialNB

df = pd.read_csv("../training_df/nb_hatespeech.csv", sep=';')

# Dividindo os dados em um conjunto de treinamento e um conjunto de teste
x = df["comment"]
y = df["isHate"]

X_train, X_test, y_train, y_test = train_test_split(x, y, test_size=0.2, random_state=42)

# Criando um pipeline com o vetorizador TF-IDF e o classificador Multinomial Naive Bayes
pipeline = make_pipeline(TfidfVectorizer(), MultinomialNB())

# Ajustando o modelo ao conjunto de treinamento
pipeline.fit(X_train, y_train)

# Salvando o pipeline em um arquivo .pkl
with open("hate_speech.pkl", "wb") as model_file:
pickle.dump(pipeline, model_file)
6 changes: 4 additions & 2 deletions api/models_code/nb_news.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import pandas as pd
import pickle
from sklearn.pipeline import make_pipeline
from sklearn.feature_extraction.text import CountVectorizer

# bag of words
from sklearn.feature_extraction.text import TfidfVectorizer

from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import MultinomialNB

df = pd.read_csv("../training_df/nb_news.csv")

# Dividindo os dados em um conjunto de treinamento e um conjunto de teste
x = df['short_description']
y = df['category']

X_train, X_test, y_train, y_test = train_test_split(x, y, test_size=0.2, random_state=42)
# Criando um pipeline que inclui o vetorizador TF-IDF e o modelo Naive Bayes

# Criando um pipeline com o vetorizador TF-IDF e o classificador Multinomial Naive Bayes
pipeline = make_pipeline(TfidfVectorizer(), MultinomialNB())
Expand Down
24 changes: 24 additions & 0 deletions api/requirements.txt.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<<<<<<< Updated upstream:api/requirements.txt
Flask==2.3.2
Flask-Cors==4.0.0
pandas==2.0.3
nltk==3.8.1
scikit-learn==1.3.0
numpy==1.25.2
matplotlib==3.7.1
seaborn==0.13.0
tensorflow==2.16.1
keras==3.0.0
=======
Flask==2.3.2
Flask-Cors==4.0.0
pandas==2.0.3
nltk==3.8.1
scikit-learn==1.3.0
numpy==1.25.2
matplotlib==3.7.1
seaborn==0.13.0
tensorflow==2.16.1
keras==3.0.0
torchtext==0.17.2
>>>>>>> Stashed changes:requirements.txt
Loading
Loading