From 9411c63ceee0fc05296692c8214f3aed0b58da61 Mon Sep 17 00:00:00 2001 From: samuel pelletier-evraire Date: Tue, 9 Apr 2024 15:49:23 -0400 Subject: [PATCH 01/30] issue #8: Adding new workflow --- .github/CODEOWNERS | 6 ++++++ .../workflows/python-api-test-workflows.yml | 21 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/python-api-test-workflows.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..c5556040 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,6 @@ +# This CODEOWNERS file is auto-generated. See the script at for modification details. + +/.github/ @ai-cfia/devops +Dockerfile @ai-cfia/devops +docker-compose.yml @ai-cfia/devops +docker-compose.*.yml @ai-cfia/devops diff --git a/.github/workflows/python-api-test-workflows.yml b/.github/workflows/python-api-test-workflows.yml new file mode 100644 index 00000000..06cc08e2 --- /dev/null +++ b/.github/workflows/python-api-test-workflows.yml @@ -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 From 61c276d0ce15f98b03621528bf39a98b5b85946e Mon Sep 17 00:00:00 2001 From: samuel pelletier-evraire Date: Tue, 9 Apr 2024 15:55:01 -0400 Subject: [PATCH 02/30] issue #8: modifying readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 19d5f209..1b56282a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # harvester-prototype + This repository is for the frontend of the project react From e41c0f88391f28b2c0f4e4f4b0212685583d2c89 Mon Sep 17 00:00:00 2001 From: samuel pelletier-evraire Date: Tue, 9 Apr 2024 16:01:19 -0400 Subject: [PATCH 03/30] issue #8 correcting error from the workflow --- .gitignore | 2 +- License | 21 ++++++++++++++ Testing.md | 7 +++++ Tests/testWithBaseQuestion.py | 3 +- app.py | 2 +- keys_questions.txt | 53 ----------------------------------- 6 files changed, 32 insertions(+), 56 deletions(-) create mode 100644 License create mode 100644 Testing.md delete mode 100644 keys_questions.txt diff --git a/.gitignore b/.gitignore index 15b65603..951f6819 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ keys.json questions.json keys_questions.txt questions_spreadsheet.csv -base_composition_questions.csv \ No newline at end of file +base_composition_questions.csv diff --git a/License b/License new file mode 100644 index 00000000..9cec9e07 --- /dev/null +++ b/License @@ -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. \ No newline at end of file diff --git a/Testing.md b/Testing.md new file mode 100644 index 00000000..cddf9da5 --- /dev/null +++ b/Testing.md @@ -0,0 +1,7 @@ +# Testing + +Run: + +```cmd +python -m unittest discover -s tests +``` \ No newline at end of file diff --git a/Tests/testWithBaseQuestion.py b/Tests/testWithBaseQuestion.py index 3006eeb2..d754648e 100644 --- a/Tests/testWithBaseQuestion.py +++ b/Tests/testWithBaseQuestion.py @@ -18,4 +18,5 @@ def test_case_2(self): pass if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main() + \ No newline at end of file diff --git a/app.py b/app.py index 6797e07f..80d1827c 100644 --- a/app.py +++ b/app.py @@ -183,4 +183,4 @@ def create_base_request(file): #generateRequest('Company_Image_Folder\Bio_Fleur', model, projectinit) #generateRequest('Company_Image_Folder\Bio_Fleur', model, projectinit) -#generateRequest('Company_Image_Folder\Bio_Fleur', model, projectinit) \ No newline at end of file +#generateRequest('Company_Image_Folder\Bio_Fleur', model, projectinit) diff --git a/keys_questions.txt b/keys_questions.txt deleted file mode 100644 index f26418b8..00000000 --- a/keys_questions.txt +++ /dev/null @@ -1,53 +0,0 @@ -Make a break line for each question and in a form of json file -if response = yes write True -if response is null write None -if you have no responses for the question write None -Combine the multiple picture data together to response question -When question contains Give : give the text on the bag -name_of_the_registrant: Give the name of the manufacturer or registrant of the fertiliser or supplement -address_of_the_registrant: Give the full address of the manufacturer or registrant (address must include: street address or post office box number, city, province or state and postal code or ZIP code, as applicable) , and the country, if the product is manufactured outside of Canada -name_of_fertiliser: Give the name of fertiliser -name_of_fertiliser_contain_term : Did the fertiliser name contain term from the list of ingredients. -npk_grade_designation: Did the fertiliser contain a main nutrient principle if true did it contain NPK() -npk: What is the NPK -registration_number: Give the registration number -instructions: Did the fertiliser instruction are on the bag? -instructions_text: Give the instructions -instructions_contain_option1: Did the instructions contain comprehensive recommendations, including crop type targeted, application rate, frequency and timing of application. -instructions_contain_option2: Did the instructions contain if the product is only intended for use as a nutrient source in blended products, a statement such as “for use only as a nutrient source for the production of fertilisers and growing media” and include intended downstream uses ( for example, for use in mixtures intended for foliar application to ornamental and edible crops). -instructions_contain_option3: Did the instructions contain a statement indicating that the user should consult a regional agricultural advisor or agricultural specialist. -contain_trace_elements: Did the fertiliser contain trace elements. -include_tank_mixing: Did the fertiliser or supplement includes tank mixing with a pest control product as its proposed directions for use, the following statements must appear on the product label -tank_mixing_text_must_include1: Did the label contain this mention \This product can be tank mixed with parasiticides. (The text may be different, but the message must be the same). -tank_mixing_text_must_include2: Did the label contain this mention \In some cases, tank-mixed pest control products may result in reduced pesticide effectiveness or increased damage to the host crop. (The text may be different, but the message must be the same). -tank_mixing_text_must_include3: Did the label contain this mention \It is recommended to perform a flocculation test before mixing the product with other fertilisers or pesticides. (The text may be different, but the message must be the same). -net_weight: Give the weight. -dry_form_product: Did the product is in dry form -mesurement_dry_form: Did the unit on the label is presented in grams (g), kilograms (kg) or tonnes (t) -mesurement_liquid_form: if dry_form_product = false --> Did the unit on the label is presented in grams (g) or kilograms (kg), but their volume may appear, in addition to weight, in milliliters (ml) or liters (l). -guaranteed_analysis: Guaranteed analysis is on the product label. -0%_guarantees: No 0% guarantee is listed in the guaranteed analysis for contaminants (for example: heavy metals or pathogens) -active_ingredients_only: Guaranteed analysis contains only active ingredients -include_minimal_requirement: If the guaranteed analysis includes "minimum", then any asset guaranteed on an actual basis (such as trace minerals) must include "(real)" next to the guarantee. -not_include_minimal_requirement: If the Guaranteed analysis does not specify a minimum, all guarantees are assumed to be actual quantities. All assets guaranteed a minimum quantity under such a heading must specify “(minimum)” (such as major plant nutrients). -minimum_n: Give the minimum amount of total nitrogen (N) expressed as a percentage. -minimum_p2o5: Give the minimum quantity of assimilable phosphoric acid (P2O5) expressed as a percentage. -contain_Phosphate: Is the fertiliser contain phosphore or phosphorous -minimum_total_phosphoric_acid: If contain_phosphate = true-->Give the total phosphoric acid in the guaranteed analysis as a percentage. -minimum_available_phosphoric_acid: contain_phosphate= true--> Give the available phosphoric acid in the guaranteed analysis as a percentage. -minimum_k2o: Give the minimum quantity of soluble potash (K2O) expressed as a percentage. -secondary_nutrient :Give the minimum amount of each secondary nutrient in a list -trace_elements: Give the trace elements as percentage. -contain_microorganism: Did the fertiliser contain microorganism. -information_microorganism1: Did the microorganism information contain --> the minimum number of viable cells per gram -information_microorganism2: Did the microorganism information contain --> for each microorganism that is not a viable cell, another descriptor of the concentration of that microorganism per gram. -complex_microorganism_group: Did the fertilizer or supplement contains component that is a complex group of microorganisms whose composition remains unchanged without further manipulation originating from a single natural environment. -descriptor_concentration: If complex_microorganism_group =true --> Did the label contain a descriptor of the concentration of viable microorganisms per gram. -neutralize_acidity_component: Did the fertilizer or supplement contains an active component intended to neutralize acidity. -minimum_calcium: if neutralize_acidity_component = true --> Give the minimum quantity of calcium as percentage of pure element. -minimum_magnesium: if neutralize_acidity_component = true --> Give the minimum quantity of magnesium as percentage of pure element. -minimum_neutralizing_power: if neutralize_acidity_component = true --> Give the minimum neutralizing power as percentage, of the acid neutralizing capacity of the calcium carbonate. -particle_size: if neutralize_acidity_component = true --> Give the particle size. -contain_organic_matter:Did the fertilizer or supplement advertised as containing organic matter. -organic_matter_information: if contain_organic_matter = true --> Give the minimum quantity of organic_matter and the the maximum moisture content expressed as a percentage. -other_component: Give the minimum or actual quantity of any other active component expressed as a percentage. \ No newline at end of file From bc1735b67e22d2d5ab965cea81b173b414250988 Mon Sep 17 00:00:00 2001 From: samuel pelletier-evraire Date: Tue, 9 Apr 2024 16:05:31 -0400 Subject: [PATCH 04/30] issue #8: adding newLine --- License | 2 +- Tests/testWithBaseQuestion.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/License b/License index 9cec9e07..b44eef8c 100644 --- a/License +++ b/License @@ -18,4 +18,4 @@ 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. \ No newline at end of file +SOFTWARE. diff --git a/Tests/testWithBaseQuestion.py b/Tests/testWithBaseQuestion.py index d754648e..5bdcd350 100644 --- a/Tests/testWithBaseQuestion.py +++ b/Tests/testWithBaseQuestion.py @@ -19,4 +19,3 @@ def test_case_2(self): if __name__ == '__main__': unittest.main() - \ No newline at end of file From 45b9a6a4bf6d8d076800e38b5beab63e5efa75d5 Mon Sep 17 00:00:00 2001 From: samuel pelletier-evraire Date: Tue, 9 Apr 2024 16:11:01 -0400 Subject: [PATCH 05/30] issue #8: adding lint to testing.md --- License | 21 --------------------- Testing.md | 2 +- 2 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 License diff --git a/License b/License deleted file mode 100644 index b44eef8c..00000000 --- a/License +++ /dev/null @@ -1,21 +0,0 @@ -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. diff --git a/Testing.md b/Testing.md index cddf9da5..f1cb42a6 100644 --- a/Testing.md +++ b/Testing.md @@ -4,4 +4,4 @@ Run: ```cmd python -m unittest discover -s tests -``` \ No newline at end of file +``` From 9a957986fb5a2755ff6c72b48855cd1338d4b969 Mon Sep 17 00:00:00 2001 From: Samuel Pelletier Evraire Date: Tue, 9 Apr 2024 16:13:47 -0400 Subject: [PATCH 06/30] issue #8: Create LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..b44eef8c --- /dev/null +++ b/LICENSE @@ -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. From e21f49a135af2770aa98bbd1bac088a53244667e Mon Sep 17 00:00:00 2001 From: samuel pelletier-evraire Date: Tue, 9 Apr 2024 16:15:06 -0400 Subject: [PATCH 07/30] issue #8: adding lint to readme.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1b56282a..8eaed09d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # harvester-prototype -This repository is for the frontend of the project react +This repository is for the frontend of the project react From ae6910a2264986ab13845a104753f9ddbd5a1335 Mon Sep 17 00:00:00 2001 From: samuel pelletier-evraire Date: Tue, 9 Apr 2024 16:18:21 -0400 Subject: [PATCH 08/30] issue#8: adding testing.md --- Testing.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Testing.md b/Testing.md index f1cb42a6..62b6f3d0 100644 --- a/Testing.md +++ b/Testing.md @@ -5,3 +5,4 @@ Run: ```cmd python -m unittest discover -s tests ``` + From 9a226191d05b47fb0a8d4785fb2de69b8a4457e0 Mon Sep 17 00:00:00 2001 From: samuel pelletier-evraire Date: Tue, 9 Apr 2024 16:19:26 -0400 Subject: [PATCH 09/30] issue #8: Adding lint to readme.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8eaed09d..64238242 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ # harvester-prototype This repository is for the frontend of the project react + From c72d13ebc86b1d9fcabc8e4ec6cf2117cd8a9fc5 Mon Sep 17 00:00:00 2001 From: Samuel Pelletier Evraire Date: Tue, 9 Apr 2024 16:20:58 -0400 Subject: [PATCH 10/30] issue #8: Create TESTING.md --- TESTING.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 TESTING.md diff --git a/TESTING.md b/TESTING.md new file mode 100644 index 00000000..62b6f3d0 --- /dev/null +++ b/TESTING.md @@ -0,0 +1,8 @@ +# Testing + +Run: + +```cmd +python -m unittest discover -s tests +``` + From 5a5b5d8a60779f35f0fe481b4602d617706554a7 Mon Sep 17 00:00:00 2001 From: samuel pelletier-evraire Date: Tue, 9 Apr 2024 16:23:22 -0400 Subject: [PATCH 11/30] issue #8: adding lint --- README.md | 1 - Testing.md | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 64238242..8eaed09d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ # harvester-prototype This repository is for the frontend of the project react - diff --git a/Testing.md b/Testing.md index 62b6f3d0..cddf9da5 100644 --- a/Testing.md +++ b/Testing.md @@ -4,5 +4,4 @@ Run: ```cmd python -m unittest discover -s tests -``` - +``` \ No newline at end of file From 7112888dd74b7eb72cc8ed50dd41cd8b55a4e93f Mon Sep 17 00:00:00 2001 From: samuel pelletier-evraire Date: Tue, 9 Apr 2024 16:24:26 -0400 Subject: [PATCH 12/30] issue #8: adding lint --- Testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Testing.md b/Testing.md index cddf9da5..f1cb42a6 100644 --- a/Testing.md +++ b/Testing.md @@ -4,4 +4,4 @@ Run: ```cmd python -m unittest discover -s tests -``` \ No newline at end of file +``` From 0bcbea3a91cd218277283b6465e7dc609e48bad8 Mon Sep 17 00:00:00 2001 From: Samuel Pelletier Evraire Date: Tue, 9 Apr 2024 16:25:51 -0400 Subject: [PATCH 13/30] Delete Testing.md --- Testing.md | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 Testing.md diff --git a/Testing.md b/Testing.md deleted file mode 100644 index f1cb42a6..00000000 --- a/Testing.md +++ /dev/null @@ -1,7 +0,0 @@ -# Testing - -Run: - -```cmd -python -m unittest discover -s tests -``` From 0e1803b625ae8392aba587072cad80fcf8f10b3f Mon Sep 17 00:00:00 2001 From: Samuel Pelletier Evraire Date: Tue, 9 Apr 2024 16:26:07 -0400 Subject: [PATCH 14/30] Update TESTING.md --- TESTING.md | 1 - 1 file changed, 1 deletion(-) diff --git a/TESTING.md b/TESTING.md index 62b6f3d0..f1cb42a6 100644 --- a/TESTING.md +++ b/TESTING.md @@ -5,4 +5,3 @@ Run: ```cmd python -m unittest discover -s tests ``` - From 3d11e03c1549550a0dc91d314be6c1d6f9dd3b0e Mon Sep 17 00:00:00 2001 From: Samuel Pelletier Evraire Date: Tue, 9 Apr 2024 16:29:54 -0400 Subject: [PATCH 15/30] Update app.py --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index 80d1827c..08561eae 100644 --- a/app.py +++ b/app.py @@ -31,7 +31,7 @@ def addText(request, number, baseQuestions=None): 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: request = addText(request, 1) From 1ad122348efe47b1d04a50b0726fd140d4138872 Mon Sep 17 00:00:00 2001 From: Samuel Pelletier Evraire Date: Tue, 9 Apr 2024 16:36:45 -0400 Subject: [PATCH 16/30] Update app.py --- app.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app.py b/app.py index 08561eae..010381fa 100644 --- a/app.py +++ b/app.py @@ -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): +def generateRequest(directory, model:GenerativeModel, vertex:vertexai, baseQuestions=None, None): request = getListImage(collect_images(directory)) - if baseQuestions == None: + if baseQuestions is None: request = addText(request, 1) else: request = addText(request, 2, baseQuestions) @@ -55,7 +55,7 @@ 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) @@ -66,7 +66,7 @@ def generateRequest(directory, model:GenerativeModel, vertex:vertexai, baseQuest def toDict(responses, baseQuestions=None): responseAsDict = {} - if baseQuestions == None: + if baseQuestions is None: for response in responses: texte = response indice = texte.find(":") @@ -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: From 3c3789246b6e45bc7beab67be6a4080b7110c9b3 Mon Sep 17 00:00:00 2001 From: Samuel Pelletier Evraire Date: Tue, 9 Apr 2024 16:37:57 -0400 Subject: [PATCH 17/30] Update app.py --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index 010381fa..f1ab9f30 100644 --- a/app.py +++ b/app.py @@ -31,7 +31,7 @@ def addText(request, number, baseQuestions=None): return request -def generateRequest(directory, model:GenerativeModel, vertex:vertexai, baseQuestions=None, None): +def generateRequest(directory, model:GenerativeModel, vertex:vertexai, baseQuestions=None): request = getListImage(collect_images(directory)) if baseQuestions is None: request = addText(request, 1) From 3668f5890dc642166b0ae42fbff13d2cdf2afd00 Mon Sep 17 00:00:00 2001 From: Samuel Pelletier Evraire Date: Tue, 9 Apr 2024 16:39:29 -0400 Subject: [PATCH 18/30] Update app.py --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index f1ab9f30..104d1c8d 100644 --- a/app.py +++ b/app.py @@ -58,7 +58,7 @@ def generateRequest(directory, model:GenerativeModel, vertex:vertexai, baseQuest if baseQuestions is None: baseQuestions = toDict(responses.text) else: - otherQuestion = toDict(responses, baseQuestions) + # otherQuestion = toDict(responses, baseQuestions) print(responses.text) From 74c6f9a22cd7ab9bd4591175bb5081a826433e81 Mon Sep 17 00:00:00 2001 From: samuel Pelletier-Evraire Date: Wed, 10 Apr 2024 09:28:24 -0400 Subject: [PATCH 19/30] issue #8: fixing app.py --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index 104d1c8d..ea305d75 100644 --- a/app.py +++ b/app.py @@ -57,7 +57,7 @@ def generateRequest(directory, model:GenerativeModel, vertex:vertexai, baseQuest if baseQuestions is None: baseQuestions = toDict(responses.text) - else: + #else: # otherQuestion = toDict(responses, baseQuestions) print(responses.text) From 57801a8fced02253d9f5c0d78916efa9ad0465a2 Mon Sep 17 00:00:00 2001 From: samuel Pelletier-Evraire Date: Wed, 10 Apr 2024 09:31:13 -0400 Subject: [PATCH 20/30] issue #8: fixing code issue --- Tests/testWithModifiedQuestion.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 Tests/testWithModifiedQuestion.py diff --git a/Tests/testWithModifiedQuestion.py b/Tests/testWithModifiedQuestion.py deleted file mode 100644 index e69de29b..00000000 From 5b4afcce3d554e02436d84c0b51d6c8462ed12b4 Mon Sep 17 00:00:00 2001 From: samuel Pelletier-Evraire Date: Wed, 10 Apr 2024 09:32:58 -0400 Subject: [PATCH 21/30] issue #8: fixing code issue. --- Tests/testWithBaseQuestion.py | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 Tests/testWithBaseQuestion.py diff --git a/Tests/testWithBaseQuestion.py b/Tests/testWithBaseQuestion.py deleted file mode 100644 index 5bdcd350..00000000 --- a/Tests/testWithBaseQuestion.py +++ /dev/null @@ -1,21 +0,0 @@ -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() From 095b7663cc134ffbfe8ade597503a62683c8d45f Mon Sep 17 00:00:00 2001 From: samuel Pelletier-Evraire Date: Wed, 10 Apr 2024 09:37:24 -0400 Subject: [PATCH 22/30] issue #8: Fixing tests issue. --- .vscode/settings.json | 11 +++++++++ .../testsWithBaseQuestion.cpython-312.pyc | Bin 0 -> 1068 bytes Tests/testWithBaseQuestion.py | 21 ++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 Tests/__pycache__/testsWithBaseQuestion.cpython-312.pyc create mode 100644 Tests/testWithBaseQuestion.py diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..72c6b900 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "python.testing.unittestArgs": [ + "-v", + "-s", + "./Tests", + "-p", + "test*.py" + ], + "python.testing.pytestEnabled": false, + "python.testing.unittestEnabled": true +} \ No newline at end of file diff --git a/Tests/__pycache__/testsWithBaseQuestion.cpython-312.pyc b/Tests/__pycache__/testsWithBaseQuestion.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8e1a8e718fe658c1739135d65de7f598fa71baf1 GIT binary patch literal 1068 zcmb_a&ubGw6n?Wm(xpv^^+!QlM8$(SM6h@g5!6cKp|N6%uq+HqcG|Ap?8cc*Wpkw4)frxz}A8bkYiL)To zW*l{#hAX$QxR5Jk5w0&r(Rv{6E Date: Wed, 10 Apr 2024 09:42:12 -0400 Subject: [PATCH 23/30] issue #8: fixing setting.json --- .vscode/settings.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 72c6b900..aae83d15 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,6 +6,5 @@ "-p", "test*.py" ], - "python.testing.pytestEnabled": false, "python.testing.unittestEnabled": true -} \ No newline at end of file +} From 50cfb1cea9a727a3857884477c8e12dfd45fde6f Mon Sep 17 00:00:00 2001 From: samuel Pelletier-Evraire Date: Wed, 10 Apr 2024 09:45:15 -0400 Subject: [PATCH 24/30] issue #8: fixing testing --- .vscode/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index aae83d15..a3e147b9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,5 +6,5 @@ "-p", "test*.py" ], - "python.testing.unittestEnabled": true + "python.testing.unittestEnabled": false } From d6c61d9f3cdaf90e7f207d9c6d1ee3c85ad53866 Mon Sep 17 00:00:00 2001 From: samuel Pelletier-Evraire Date: Wed, 10 Apr 2024 09:49:29 -0400 Subject: [PATCH 25/30] issue #8: fixing tests --- .vscode/settings.json | 2 +- TESTING.md | 2 +- .../testWithBaseQuestion.cpython-312.pyc | Bin 0 -> 1062 bytes 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 Tests/__pycache__/testWithBaseQuestion.cpython-312.pyc diff --git a/.vscode/settings.json b/.vscode/settings.json index a3e147b9..aae83d15 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,5 +6,5 @@ "-p", "test*.py" ], - "python.testing.unittestEnabled": false + "python.testing.unittestEnabled": true } diff --git a/TESTING.md b/TESTING.md index f1cb42a6..e5273a89 100644 --- a/TESTING.md +++ b/TESTING.md @@ -3,5 +3,5 @@ Run: ```cmd -python -m unittest discover -s tests +python -m unittest discover -s Tests ``` diff --git a/Tests/__pycache__/testWithBaseQuestion.cpython-312.pyc b/Tests/__pycache__/testWithBaseQuestion.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..94e4c9a05c4dfa1ac2e86754468cb2fe4dc8eb22 GIT binary patch literal 1062 zcmb_a&ubGw6n?Wm(xpv^)l#rQDB{6D6)YY^L{KZOhsKI6!m=li=^&)uk7P>u1PrkRwT9l|D&f%Ny@xFQAn>X{WQkeu?-`>n_9x{M0 z6co!Gk<3G~2OfCL2OBh422bmQrwe$h72?zVKp%2j6S`-#F9XQ48lcuX)fDVtL>MG2 zVRiE>#f@f>rX9P=S9S@vJ*;Ch4{Xh2eXw=v!!|q}(ew<&QexIi=}atC{G=6c-*uIE z)Wx6`2F;?1-$=m9r*%U&JjT@9#+Wv9lyp zI}Rgf#g#i)T*!5@2)35PaLX5W)*d+9MdnH*!#IqSNH`=?&bZdDMoDTa5pP7jxv}{? zN3CY`D7*04DrZRG&v%j~l*kDJn*H!rk{&#@V&TfA@OjX?FxIe0(>Ylts382a-4vPd zCcXy0)|>y0;}1pd_g_sH|7yB;=BJxB>JzEOdEj;g=jkNpozUz0#LJvN>$?6hBd6$8 zm0+6S96>&C8dpAQNzax8{Wmp>(1#;UGb=|{0U5D;!nu%~J8moByl$peH)zE)vD8{e zyoWO!mYl&#sX@A598auU!)|ZO8fxe-tLq2@oiX+as>eo^Ro>qCP+NFkTQ~*`1{c97 bzwRCC=RX?LyDP6&U#z}-IMBhE%bWTRJ$>+u literal 0 HcmV?d00001 From f660fdb18b4602f482e6bc7202feae9379ea278d Mon Sep 17 00:00:00 2001 From: samuel Pelletier-Evraire Date: Wed, 10 Apr 2024 09:51:46 -0400 Subject: [PATCH 26/30] issue #8: Fixing test by adding __init__.py --- Tests/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Tests/__init__.py diff --git a/Tests/__init__.py b/Tests/__init__.py new file mode 100644 index 00000000..e69de29b From 31034a2bf0ba8de747ae8a19436ce02038ba5a97 Mon Sep 17 00:00:00 2001 From: samuel Pelletier-Evraire Date: Wed, 10 Apr 2024 10:02:59 -0400 Subject: [PATCH 27/30] issue #8: fixing testing --- ...testWithBaseQuestion.py => test_whit_base_question.py} | 0 app.py | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) rename Tests/{testWithBaseQuestion.py => test_whit_base_question.py} (100%) diff --git a/Tests/testWithBaseQuestion.py b/Tests/test_whit_base_question.py similarity index 100% rename from Tests/testWithBaseQuestion.py rename to Tests/test_whit_base_question.py diff --git a/app.py b/app.py index ea305d75..d16ff5d3 100644 --- a/app.py +++ b/app.py @@ -175,11 +175,11 @@ 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) From 01dfcfd3884425ceb19628b5e48395780099dd39 Mon Sep 17 00:00:00 2001 From: Samuel Pelletier Evraire Date: Wed, 10 Apr 2024 10:04:22 -0400 Subject: [PATCH 28/30] Delete Tests directory --- Tests/__init__.py | 0 .../testWithBaseQuestion.cpython-312.pyc | Bin 1062 -> 0 bytes .../testsWithBaseQuestion.cpython-312.pyc | Bin 1068 -> 0 bytes Tests/test_whit_base_question.py | 21 ------------------ 4 files changed, 21 deletions(-) delete mode 100644 Tests/__init__.py delete mode 100644 Tests/__pycache__/testWithBaseQuestion.cpython-312.pyc delete mode 100644 Tests/__pycache__/testsWithBaseQuestion.cpython-312.pyc delete mode 100644 Tests/test_whit_base_question.py diff --git a/Tests/__init__.py b/Tests/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/Tests/__pycache__/testWithBaseQuestion.cpython-312.pyc b/Tests/__pycache__/testWithBaseQuestion.cpython-312.pyc deleted file mode 100644 index 94e4c9a05c4dfa1ac2e86754468cb2fe4dc8eb22..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1062 zcmb_a&ubGw6n?Wm(xpv^)l#rQDB{6D6)YY^L{KZOhsKI6!m=li=^&)uk7P>u1PrkRwT9l|D&f%Ny@xFQAn>X{WQkeu?-`>n_9x{M0 z6co!Gk<3G~2OfCL2OBh422bmQrwe$h72?zVKp%2j6S`-#F9XQ48lcuX)fDVtL>MG2 zVRiE>#f@f>rX9P=S9S@vJ*;Ch4{Xh2eXw=v!!|q}(ew<&QexIi=}atC{G=6c-*uIE z)Wx6`2F;?1-$=m9r*%U&JjT@9#+Wv9lyp zI}Rgf#g#i)T*!5@2)35PaLX5W)*d+9MdnH*!#IqSNH`=?&bZdDMoDTa5pP7jxv}{? zN3CY`D7*04DrZRG&v%j~l*kDJn*H!rk{&#@V&TfA@OjX?FxIe0(>Ylts382a-4vPd zCcXy0)|>y0;}1pd_g_sH|7yB;=BJxB>JzEOdEj;g=jkNpozUz0#LJvN>$?6hBd6$8 zm0+6S96>&C8dpAQNzax8{Wmp>(1#;UGb=|{0U5D;!nu%~J8moByl$peH)zE)vD8{e zyoWO!mYl&#sX@A598auU!)|ZO8fxe-tLq2@oiX+as>eo^Ro>qCP+NFkTQ~*`1{c97 bzwRCC=RX?LyDP6&U#z}-IMBhE%bWTRJ$>+u diff --git a/Tests/__pycache__/testsWithBaseQuestion.cpython-312.pyc b/Tests/__pycache__/testsWithBaseQuestion.cpython-312.pyc deleted file mode 100644 index 8e1a8e718fe658c1739135d65de7f598fa71baf1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1068 zcmb_a&ubGw6n?Wm(xpv^^+!QlM8$(SM6h@g5!6cKp|N6%uq+HqcG|Ap?8cc*Wpkw4)frxz}A8bkYiL)To zW*l{#hAX$QxR5Jk5w0&r(Rv{6E Date: Wed, 10 Apr 2024 10:05:55 -0400 Subject: [PATCH 29/30] issue #8: removing Tests and adding tests --- tests/__init__.py | 0 .../testWithBaseQuestion.cpython-312.pyc | Bin 0 -> 1062 bytes .../testsWithBaseQuestion.cpython-312.pyc | Bin 0 -> 1068 bytes tests/test_whit_base_question.py | 21 ++++++++++++++++++ 4 files changed, 21 insertions(+) create mode 100644 tests/__init__.py create mode 100644 tests/__pycache__/testWithBaseQuestion.cpython-312.pyc create mode 100644 tests/__pycache__/testsWithBaseQuestion.cpython-312.pyc create mode 100644 tests/test_whit_base_question.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/__pycache__/testWithBaseQuestion.cpython-312.pyc b/tests/__pycache__/testWithBaseQuestion.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..94e4c9a05c4dfa1ac2e86754468cb2fe4dc8eb22 GIT binary patch literal 1062 zcmb_a&ubGw6n?Wm(xpv^)l#rQDB{6D6)YY^L{KZOhsKI6!m=li=^&)uk7P>u1PrkRwT9l|D&f%Ny@xFQAn>X{WQkeu?-`>n_9x{M0 z6co!Gk<3G~2OfCL2OBh422bmQrwe$h72?zVKp%2j6S`-#F9XQ48lcuX)fDVtL>MG2 zVRiE>#f@f>rX9P=S9S@vJ*;Ch4{Xh2eXw=v!!|q}(ew<&QexIi=}atC{G=6c-*uIE z)Wx6`2F;?1-$=m9r*%U&JjT@9#+Wv9lyp zI}Rgf#g#i)T*!5@2)35PaLX5W)*d+9MdnH*!#IqSNH`=?&bZdDMoDTa5pP7jxv}{? zN3CY`D7*04DrZRG&v%j~l*kDJn*H!rk{&#@V&TfA@OjX?FxIe0(>Ylts382a-4vPd zCcXy0)|>y0;}1pd_g_sH|7yB;=BJxB>JzEOdEj;g=jkNpozUz0#LJvN>$?6hBd6$8 zm0+6S96>&C8dpAQNzax8{Wmp>(1#;UGb=|{0U5D;!nu%~J8moByl$peH)zE)vD8{e zyoWO!mYl&#sX@A598auU!)|ZO8fxe-tLq2@oiX+as>eo^Ro>qCP+NFkTQ~*`1{c97 bzwRCC=RX?LyDP6&U#z}-IMBhE%bWTRJ$>+u literal 0 HcmV?d00001 diff --git a/tests/__pycache__/testsWithBaseQuestion.cpython-312.pyc b/tests/__pycache__/testsWithBaseQuestion.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8e1a8e718fe658c1739135d65de7f598fa71baf1 GIT binary patch literal 1068 zcmb_a&ubGw6n?Wm(xpv^^+!QlM8$(SM6h@g5!6cKp|N6%uq+HqcG|Ap?8cc*Wpkw4)frxz}A8bkYiL)To zW*l{#hAX$QxR5Jk5w0&r(Rv{6E Date: Wed, 10 Apr 2024 10:15:24 -0400 Subject: [PATCH 30/30] issue #8: adding *.pyc to git ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 951f6819..8c051a27 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ questions.json keys_questions.txt questions_spreadsheet.csv base_composition_questions.csv +*.pyc