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

issue #8: Adding new workflow #9

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9411c63
issue #8: Adding new workflow
SamuelPelletierEvraire Apr 9, 2024
61c276d
issue #8: modifying readme
SamuelPelletierEvraire Apr 9, 2024
e41c0f8
issue #8 correcting error from the workflow
SamuelPelletierEvraire Apr 9, 2024
bc1735b
issue #8: adding newLine
SamuelPelletierEvraire Apr 9, 2024
45b9a6a
issue #8: adding lint to testing.md
SamuelPelletierEvraire Apr 9, 2024
9a95798
issue #8: Create LICENSE
SamuelPelletierEvraire Apr 9, 2024
e21f49a
issue #8: adding lint to readme.md
SamuelPelletierEvraire Apr 9, 2024
88bee82
Merge branch '8-adding-workflow-for-python-and-markdown-checkup' of h…
SamuelPelletierEvraire Apr 9, 2024
ae6910a
issue#8: adding testing.md
SamuelPelletierEvraire Apr 9, 2024
9a22619
issue #8: Adding lint to readme.md
SamuelPelletierEvraire Apr 9, 2024
c72d13e
issue #8: Create TESTING.md
SamuelPelletierEvraire Apr 9, 2024
5a5b5d8
issue #8: adding lint
SamuelPelletierEvraire Apr 9, 2024
7112888
issue #8: adding lint
SamuelPelletierEvraire Apr 9, 2024
0bcbea3
Delete Testing.md
SamuelPelletierEvraire Apr 9, 2024
0e1803b
Update TESTING.md
SamuelPelletierEvraire Apr 9, 2024
3d11e03
Update app.py
SamuelPelletierEvraire Apr 9, 2024
1ad1223
Update app.py
SamuelPelletierEvraire Apr 9, 2024
3c37892
Update app.py
SamuelPelletierEvraire Apr 9, 2024
3668f58
Update app.py
SamuelPelletierEvraire Apr 9, 2024
74c6f9a
issue #8: fixing app.py
SamuelPelletierEvraire Apr 10, 2024
57801a8
issue #8: fixing code issue
SamuelPelletierEvraire Apr 10, 2024
5b4afcc
issue #8: fixing code issue.
SamuelPelletierEvraire Apr 10, 2024
095b766
issue #8: Fixing tests issue.
SamuelPelletierEvraire Apr 10, 2024
ea87017
issue #8: fixing setting.json
SamuelPelletierEvraire Apr 10, 2024
50cfb1c
issue #8: fixing testing
SamuelPelletierEvraire Apr 10, 2024
d6c61d9
issue #8: fixing tests
SamuelPelletierEvraire Apr 10, 2024
f660fdb
issue #8: Fixing test by adding __init__.py
SamuelPelletierEvraire Apr 10, 2024
31034a2
issue #8: fixing testing
SamuelPelletierEvraire Apr 10, 2024
01dfcfd
Delete Tests directory
SamuelPelletierEvraire Apr 10, 2024
8b87c6e
issue #8: removing Tests and adding tests
SamuelPelletierEvraire Apr 10, 2024
b1103f5
issue #8: adding *.pyc to git ignore
SamuelPelletierEvraire Apr 10, 2024
32db53e
Merge branch '8-adding-workflow-for-python-and-markdown-checkup' of h…
SamuelPelletierEvraire Apr 10, 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
6 changes: 6 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This CODEOWNERS file is auto-generated. See the script at <https://github.com/ai-cfia/devops/blob/main/github-management-script/codeowners-file-creation.sh> for modification details.

/.github/ @ai-cfia/devops
Dockerfile @ai-cfia/devops
docker-compose.yml @ai-cfia/devops
docker-compose.*.yml @ai-cfia/devops
21 changes: 21 additions & 0 deletions .github/workflows/python-api-test-workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Python api-test workflows

on:
pull_request:
types:
- opened
- closed
- synchronize

jobs:
markdown-check:
uses: ai-cfia/github-workflows/.github/workflows/workflow-markdown-check.yml@main
secrets: inherit

repo-standard:
uses: ai-cfia/github-workflows/.github/workflows/workflow-repo-standards-validation.yml@main
secrets: inherit

test-python:
uses: ai-cfia/github-workflows/.github/workflows/workflow-lint-test-python.yml@main
secrets: inherit
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ keys.json
questions.json
keys_questions.txt
questions_spreadsheet.csv
base_composition_questions.csv
base_composition_questions.csv
*.pyc
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"python.testing.unittestArgs": [
"-v",
"-s",
"./Tests",
"-p",
"test*.py"
],
"python.testing.unittestEnabled": true
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 AI @ Canadian Food Inspection Agency (CFIA)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# harvester-prototype
This repository is for the frontend of the project react

This repository is for the frontend of the project react
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

description incorrect

7 changes: 7 additions & 0 deletions TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Testing

Run:

```cmd
python -m unittest discover -s Tests
```
28 changes: 14 additions & 14 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ def getListImage(image_paths):
return request

def addText(request, number, baseQuestions=None):
if baseQuestions == None:
if baseQuestions is None:
request.append(create_base_request(read_csv_file("base_composition_questions.csv")))
else:
request.append(create_final_request(read_csv_file("questions_spreadsheet.csv"), baseQuestions))

return request

def generateRequest(directory, model:GenerativeModel, vertex:vertexai, baseQuestions=None, typeOfQuestion):
def generateRequest(directory, model:GenerativeModel, vertex:vertexai, baseQuestions=None):
request = getListImage(collect_images(directory))
if baseQuestions == None:
if baseQuestions is None:
request = addText(request, 1)
else:
request = addText(request, 2, baseQuestions)
Expand All @@ -55,18 +55,18 @@ def generateRequest(directory, model:GenerativeModel, vertex:vertexai, baseQuest
stream=False,
)

if baseQuestions == None:
if baseQuestions is None:
baseQuestions = toDict(responses.text)
else:
otherQuestion = toDict(responses, baseQuestions)
#else:
# otherQuestion = toDict(responses, baseQuestions)

print(responses.text)

return baseQuestions

def toDict(responses, baseQuestions=None):
responseAsDict = {}
if baseQuestions == None:
if baseQuestions is None:
for response in responses:
texte = response
indice = texte.find(":")
Expand All @@ -85,10 +85,10 @@ def create_final_request(file, baseQuestions, typeOfQuestion):
for index, line in file.iterrows():
if not line.isnull().all():
categorie = str(line['Categories'])
if line['Specification'] != None:
if line['Specification'] is not None:
request_AsText += str(line['Specification']) + "\n"

if line['Categories'] != None:
if line['Categories'] is not None:
if "not_asked" in categorie:
break
elif "all" in categorie:
Expand Down Expand Up @@ -175,12 +175,12 @@ def create_base_request(file):
model = GenerativeModel("gemini-1.0-pro-vision-001")
projectinit=vertexai.init(project="test-application-2-416219", location="northamerica-northeast1")
#Original question
baseQuestions = generateRequest('Company_Image_Folder\\Acti_Sol1', model, projectinit, None, "Original_question")
baseQuestions = generateRequest('Company_Image_Folder\\Acti_Sol1', model, projectinit, baseQuestions, "Original_question")
baseQuestions = generateRequest('company_image_folder\\Acti_Sol1', model, projectinit, None, "Original_question")
baseQuestions = generateRequest('company_image_folder\\Acti_Sol1', model, projectinit, baseQuestions, "Original_question")
# Modified question
baseQuestions = generateRequest('Company_Image_Folder\\Acti_Sol1', model, projectinit, None, "Modified_question")
baseQuestions = generateRequest('Company_Image_Folder\\Acti_Sol1', model, projectinit, baseQuestions, "Modified_question")
baseQuestions = generateRequest('company_image_folder\\Acti_Sol1', model, projectinit, None, "Modified_question")
baseQuestions = generateRequest('company_image_folder\\Acti_Sol1', model, projectinit, baseQuestions, "Modified_question")

#generateRequest('Company_Image_Folder\Bio_Fleur', model, projectinit)
#generateRequest('Company_Image_Folder\Bio_Fleur', model, projectinit)
#generateRequest('Company_Image_Folder\Bio_Fleur', model, projectinit)
#generateRequest('Company_Image_Folder\Bio_Fleur', model, projectinit)
53 changes: 0 additions & 53 deletions keys_questions.txt

This file was deleted.

File renamed without changes.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import unittest

class testWithBaseQuestion(unittest.TestCase):
def setUp(self):
# This method will be called before each test
pass

def tearDown(self):
# This method will be called after each test
pass

def test_case_1(self):
# Write your test case here
pass

def test_case_2(self):
# Write your test case here
pass

if __name__ == '__main__':
unittest.main()
import unittest
class testWithBaseQuestion(unittest.TestCase):
def setUp(self):
# This method will be called before each test
pass
def tearDown(self):
# This method will be called after each test
pass
def test_case_1(self):
# Write your test case here
pass
def test_case_2(self):
# Write your test case here
pass
if __name__ == '__main__':
unittest.main()
Loading