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

6 update repo description to emphasize prototyping #10

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
57 changes: 55 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,56 @@
# harvester-prototype

This repository is for the frontend of the project react
# Harvester Prototype (FertiScan)

## Overview Description

---
The FertiScan project, initiated by the AI-Lab, aims to streamline the process
of capturing and organizing information on fertilizer labels. By leveraging AI
technology, the mobile application will allow users to scan fertilizer labels,
extract essential data, and automatically load this data into a database for
easy access and analysis. This project involves the AI-Lab, the CFIA, and
clients such as inspectors and teams who will benefit from the streamlined
process. FertiScan is a web application that facilitates the inspection process
wherever internet access is available. By automating fertilizer bag inspection,
the project aims to increase the efficiency and accuracy of the inspection
process. Through the integration of the Gemini Vertex API, the system can
analyze fertilizer bag labels more thoroughly, identifying not only basic
SamuelPelletierEvraire marked this conversation as resolved.
Show resolved Hide resolved
information but also subtle differences that may escape human inspection.
The Harvester prototype is a crucial step towards realizing a complete
automated inspection system. With continuous testing and improvements, it has
the potential to transform the way fertilizer bag inspections are conducted,
bringing an advanced technological solution to the agricultural sector.

## Key Features

---
**Gemini Vertex API:** An application programming interface designed to
simulate human conversation, capable of answering questions and processing
a large number of images.
**Testing Process:** Rigorous testing is conducted to demonstrate that
the Gemini Vertex API, created by Google, is the appropriate method for the
Harvester project.
It meets various criteria and achieves two main objectives:
reading labels during recording and identifying differences with bags analyzed
by inspectors.

## Potential Advantages

---
**Increased Efficiency:** By automating fertilizer bag inspection, the project
aims to increase the efficiency and accuracy of the inspection process.
**Advanced Analysis:** Through the integration of the Gemini Vertex API, the
system can analyze fertilizer bag labels more thoroughly, identifying not only
basic information but also subtle differences that may escape human inspection.

## Future Outlook

The Harvester prototype is a crucial step toward realizing a
comprehensive automated inspection system. With continuous testing and
improvements, it has the potential to transform the way fertilizer bag
inspections are conducted, bringing an advanced technological
solution to the agricultural sector.

SamuelPelletierEvraire marked this conversation as resolved.
Show resolved Hide resolved
## References

You can find more information on the official site of Google gemini vertex ai: <https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini?hl=fr>
44 changes: 22 additions & 22 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ def getListImage(image_paths):
with open(image_data, 'rb') as f:
image = f.read()
request.append(Part.from_data(data=image, mime_type="image/jpeg"))

return request

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

return request
Expand All @@ -53,20 +53,20 @@ def generateRequest(directory, model:GenerativeModel, vertex:vertexai, baseQuest
}
),
stream=False,
)
)

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

print(responses.text)

return baseQuestions

def toDict(responses, baseQuestions=None):
responseAsDict = {}
if baseQuestions is None:
if baseQuestions is None:
for response in responses:
texte = response
indice = texte.find(":")
Expand Down Expand Up @@ -101,10 +101,10 @@ def create_final_request(file, baseQuestions, typeOfQuestion):

if "seed" in categorie and "is_seed" in baseQuestions:
request_AsText = addLine(request_AsText, line)

if "tank_mixing" in categorie and "is_tank_mixing" in baseQuestions:
request_AsText = addLine(request_AsText, line)

if "microorganism" in categorie and "contain_microorganism" in baseQuestions:
request_AsText = addLine(request_AsText, line)

Expand All @@ -127,10 +127,10 @@ def create_final_request(file, baseQuestions, typeOfQuestion):

if "seed" in categorie & "is_seed" in baseQuestions:
request_AsText = addLine(request_AsText, line)

if "tank_mixing" in categorie & "is_tank_mixing" in baseQuestions:
request_AsText = addLine(request_AsText, line)

if "microorganism" in categorie & "contain_microorganism" in baseQuestions:
request_AsText = addLine(request_AsText, line)

Expand All @@ -149,7 +149,7 @@ def create_final_request(file, baseQuestions, typeOfQuestion):
if "mixture_product" in categorie and "is_mixture_product" in baseQuestions:
request_AsText = addLine(request_AsText, line)
return request_AsText


def addLine(requestAsText, line, typeOfQuestion):
if not line.isnull().all():
Expand All @@ -163,24 +163,24 @@ def create_base_request(file):
if not line.isnull().all():
specification = line['Specification']
requestAsText += str(specification) + "\n"

line_text = str(line['Key']) + ":" + str(line['Question']) + "; \n"
requestAsText += line_text
return requestAsText








model = GenerativeModel("gemini-1.0-pro-vision-001")
projectinit=vertexai.init(project="test-application-2-416219", location="northamerica-northeast1")
SamuelPelletierEvraire marked this conversation as resolved.
Show resolved Hide resolved
#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)
#generateRequest('Company_Image_Folder\\Bio_Fleur', model, projectinit)
#generateRequest('Company_Image_Folder\\Bio_Fleur', model, projectinit)
Loading