contact@digitalnotebooks.co
Stay Organized, Stay Inspired. Let's Write.

Plant Analysis Tool using Gemini AI and Express.js Part 1

Back To All Notes
  • Notebook: Node.js (JavaScript) Projects
  • Speaker: Masynctech
  • Date Created: Sept. 14, 2024, 11:53 p.m.
  • Owner: Rosilie

We used NODE.JS (Javascript) and NVM.

MAIN VIDEO RESOURCE: 

1. We created a new folder, PLANTANALYSIS TOOL.

2. We open a Gitbash Terminal here and use CODE . (code dot) to open our VS CODE editor.

3. We Install NODE.JS, CODEIUM  EXTENSION IN VSCODE EXTENSIONS  and get Google  API key from Google API dashboard.

 

 

We use GOOGLE API REFERENCE to install our GENERATIVE AI in NODE.JS:

4. We created new folders like UPLOAD, PUBLIC and created APPS.JS and .ENV files

.ENV FILE:

APPS.JS

5. To test our ENDPOINT, we will use POSTMAN (you used INSOMNIA)  or we can install the VS CODE EXTENSION, THUNDER CLIENT.

6.  Run the app by issuing this  code. 

$ node --watch app (where app is our APPS.JS)

 

7.  Close all your tabs in VS Code. Right click on the THREE DOTS  where the EXTENSION button is, and select THUNDER POINT. Select NEW REQUEST.

8. To access our work, we issue our URL path: HTTP://localhost: 5000. This should show a SUCCESS MESSAGE

9. We test our other endpoint, HTTP:://LOCALHOST:DOWNLOAD/ We duplicate our first request and name it. Then, we change our URL PATH. 

10. Just like in Django where we test our paths using Django's views.py, the logic for Node.js is this:

11.  To test the upload function, we can use the THUNDER BODY\FORM and add the variable we used 'IMAGE' and upload a file from our local device. We should be able to see the details of this image.

APPS.JS:

12.  To allow Gemini AI to use the details captured from step 11, we have to indicate the GEMINI VERSION:

13. We updated our APPS.JS to include GEMINI API. 

This is the PROMPT we used for Gemini "Analyze this plant image and provide detailed analysis of its species, health and care recommendations, its characteristics, care instructions and interesting facts. Please provide the response in plain text without using any markdown formatting "

Our function:

14. We run our endpoint using Thunder Client:

15. 

 



No PDF file attached.

Notebook
Notebook Details
Title: Node.js (JavaScript) Projects
Category: Node.js