GithubHelp home page GithubHelp logo

cropai / backend Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 27.0 6.82 MB

This API acts as a crop advisory app for farmers, extension workers and gardeners. It can diagnose plant diseases, pest damages and nutrient deficiencies affecting crops and offers corresponding treatment measures. Deployed on : https://crop-leaf.herokuapp.com/

License: GNU General Public License v3.0

JavaScript 75.64% HTML 7.35% CSS 9.01% Python 8.00%
express-js git heroku nodejs python-shell

backend's People

Contributors

abhishekgupta368 avatar abhushanaj avatar adityasingh17 avatar ashishnagpal2498 avatar dev-rocky avatar geesa-vihara avatar gshanbhag525 avatar kuljeet-123 avatar rajats98 avatar sapna2001 avatar satyam3976 avatar shreyakapoor08 avatar shubhambansal1997 avatar shwetagurnani avatar skshahnawaz avatar souvikns avatar subhashreetrip avatar tanishq9 avatar vngarg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

backend's Issues

Make a text file for leaf disease "Potato___healthy"

You should make a text file for this leaf disease and add the symptoms, treatment and recommended products for this leaf disease in leaf disease data folder.

FORMAT OF TEXT FILE

Symptoms : (Write atleast 3 points)

Treatment : (Write atleast 2/3 points)

Recommended Products : (Give 2 or 3 links)

EXAMPLE TEXT FILE WITH CORRECT FORMAT

Symptoms :
1 : The lesions are dark brown and appear leathery with faint, concentric rings giving a target-spot effect.
2 : At first the spots are small (1 /8 inches in diameter) and oval or angular in shape, but later the spots can enlarge to about 1/2 inches.

Treatment :
1 : Plant only diseasefree, certified seed.
2 : Follow a complete and regular foliar fungicide spray program.
3 : Allow tubers to mature before digging, dig when vines are dry, not wet, and avoid excessive wounding of potatoes during harvesting and handling.

Recommended products :
1 : Harvest-Guard : https://www.planetnatural.com/product/floating-row-cover/
2 : AllDown : https://www.planetnatural.com/product/vinegar-weed-killer/

Add ISSUE_TEMPLATE

I am a GSSOC participant and I would like to add an issue template folder with pull request template bug_report_template.md and feature_request_template.md.

Screenshots

Bug Report

bug report

Feature request

feature request

Pull request

pull request

Make a text file for leaf disease "Pepper__bell___healthy"

You should make a text file for this leaf disease and add the symptoms, treatment and recommended products for this leaf disease in leaf disease data folder.

FORMAT OF TEXT FILE

Symptoms : (Write atleast 3 points)

Treatment : (Write atleast 2/3 points)

Recommended Products : (Give 2 or 3 links)

EXAMPLE TEXT FILE WITH CORRECT FORMAT

Symptoms :
1 : The lesions are dark brown and appear leathery with faint, concentric rings giving a target-spot effect.
2 : At first the spots are small (1 /8 inches in diameter) and oval or angular in shape, but later the spots can enlarge to about 1/2 inches.

Treatment :
1 : Plant only diseasefree, certified seed.
2 : Follow a complete and regular foliar fungicide spray program.
3 : Allow tubers to mature before digging, dig when vines are dry, not wet, and avoid excessive wounding of potatoes during harvesting and handling.

Recommended products :
1 : Harvest-Guard : https://www.planetnatural.com/product/floating-row-cover/
2 : AllDown : https://www.planetnatural.com/product/vinegar-weed-killer/

Restructure output JSON

Currently, we have 3 keys in JSON for every 'leaf disease' which are : symptoms, treatment and recommended products, add one more key of name : 'category' which tells the leaf disease name.

Make a text file for leaf disease "Tomato__Tomato_mosaic_virus"

You should make a text file for this leaf disease and add the symptoms, treatment and recommended products for this leaf disease in leaf disease data folder.

FORMAT OF TEXT FILE

Symptoms : (Write atleast 3 points)

Treatment : (Write atleast 2/3 points)

Recommended Products : (Give 2 or 3 links)

EXAMPLE TEXT FILE WITH CORRECT FORMAT

Symptoms :
1 : The lesions are dark brown and appear leathery with faint, concentric rings giving a target-spot effect.
2 : At first the spots are small (1 /8 inches in diameter) and oval or angular in shape, but later the spots can enlarge to about 1/2 inches.

Treatment :
1 : Plant only diseasefree, certified seed.
2 : Follow a complete and regular foliar fungicide spray program.
3 : Allow tubers to mature before digging, dig when vines are dry, not wet, and avoid excessive wounding of potatoes during harvesting and handling.

Recommended products :
1 : Harvest-Guard : https://www.planetnatural.com/product/floating-row-cover/
2 : AllDown : https://www.planetnatural.com/product/vinegar-weed-killer/

Add contributing guidelines

List the basic to advanced git concepts and commands that a participant would require to contribute to any particular repository's codebase, also telling about the best practices for contributing.

Since, every contributor for this repository will have to go through it, so try to make it as intuitive, detailed and informative as possible.

Should preferably be a markdown(.md) file.

Add body parser and static middleware by Express in server.js

Since, we are passing a form from frontend so we have to parse incoming request bodies in a middleware. Also, to serve static files such as images, CSS files, and JavaScript files, use the express.static built-in middleware function in Express.

Incorporate these changes in server.js.

use formidable module for parsing form data, i.e file uploads, save this file in the backend and pass this as argument to dummy.py. [JS+PYTHON]

Refer this to know how to use formidable : https://www.npmjs.com/package/formidable

Also, the dummy.py script should return the first 5 characters of the file name, why ? Just to check whether we are able to correctly send the file path from the child process that we created in '/file_upload' route

Make sure the image file is being saved in the backend, this image will be required by our python script later on.

Add CODE_OF_CONDUCT.md

Is your feature request related to a problem? Please describe.
No CODE_OF_CONDUCT.md file is present.

Describe the solution you'd like
@gshanbhag525 As a GSSOC participant I would like to add a CODE_OF_CONDUCT.md file in this project. Using this as a reference.

Additional context

Screenshots

code of conduct1
code of conduct2

Make a text file for leaf disease "Pepper__bell___Bacterial_spot"

You should make a text file for this leaf disease and add the symptoms, treatment and recommended products for this leaf disease in leaf disease data folder.

FORMAT OF TEXT FILE

Symptoms : (Write atleast 3 points)

Treatment : (Write atleast 2/3 points)

Recommended Products : (Give 2 or 3 links)

EXAMPLE TEXT FILE WITH CORRECT FORMAT

Symptoms :
1 : The lesions are dark brown and appear leathery with faint, concentric rings giving a target-spot effect.
2 : At first the spots are small (1 /8 inches in diameter) and oval or angular in shape, but later the spots can enlarge to about 1/2 inches.

Treatment :
1 : Plant only diseasefree, certified seed.
2 : Follow a complete and regular foliar fungicide spray program.
3 : Allow tubers to mature before digging, dig when vines are dry, not wet, and avoid excessive wounding of potatoes during harvesting and handling.

Recommended products :
1 : Harvest-Guard : https://www.planetnatural.com/product/floating-row-cover/
2 : AllDown : https://www.planetnatural.com/product/vinegar-weed-killer/

Make a text file for leaf disease "Tomato_Leaf_Mold"

You should make a text file for this leaf disease and add the symptoms, treatment and recommended products for this leaf disease in leaf disease data folder.

FORMAT OF TEXT FILE

Symptoms : (Write atleast 3 points)

Treatment : (Write atleast 2/3 points)

Recommended Products : (Give 2 or 3 links)

EXAMPLE TEXT FILE WITH CORRECT FORMAT

Symptoms :
1 : The lesions are dark brown and appear leathery with faint, concentric rings giving a target-spot effect.
2 : At first the spots are small (1 /8 inches in diameter) and oval or angular in shape, but later the spots can enlarge to about 1/2 inches.

Treatment :
1 : Plant only diseasefree, certified seed.
2 : Follow a complete and regular foliar fungicide spray program.
3 : Allow tubers to mature before digging, dig when vines are dry, not wet, and avoid excessive wounding of potatoes during harvesting and handling.

Recommended products :
1 : Harvest-Guard : https://www.planetnatural.com/product/floating-row-cover/
2 : AllDown : https://www.planetnatural.com/product/vinegar-weed-killer/

Make a text file for leaf disease "Tomato_Spider_mites_Two_spotted_spider_mite"

You should make a text file for this leaf disease and add the symptoms, treatment and recommended products for this leaf disease in leaf disease data folder.

FORMAT OF TEXT FILE

Symptoms : (Write atleast 3 points)

Treatment : (Write atleast 2/3 points)

Recommended Products : (Give 2 or 3 links)

EXAMPLE TEXT FILE WITH CORRECT FORMAT

Symptoms :
1 : The lesions are dark brown and appear leathery with faint, concentric rings giving a target-spot effect.
2 : At first the spots are small (1 /8 inches in diameter) and oval or angular in shape, but later the spots can enlarge to about 1/2 inches.

Treatment :
1 : Plant only diseasefree, certified seed.
2 : Follow a complete and regular foliar fungicide spray program.
3 : Allow tubers to mature before digging, dig when vines are dry, not wet, and avoid excessive wounding of potatoes during harvesting and handling.

Recommended products :
1 : Harvest-Guard : https://www.planetnatural.com/product/floating-row-cover/
2 : AllDown : https://www.planetnatural.com/product/vinegar-weed-killer/

Make a dummy python file and call it inside server.js when file submit button is clicked

We would be calling Python script from a Node child process, using python-shell package. The dummy .py file should print("script called"), this .py script will be called on post request at route '/file_upload'. To know more about integrating node with python, read this :

https://medium.com/@HolmesLaurence/integrating-node-and-python-6b8454bfc272

It is mentioned in this blog, how to create node child process using python-shell package, go through this, we will be using the same method as 'Version 2: calling Python script from a Node child process, using python-shell package' mentioned in the above blog.

Make a text file for leaf disease "Potato___Early_blight"

You should make a text file for this leaf disease and add the symptoms, treatment and recommended products for this leaf disease in leaf disease data folder.

FORMAT OF TEXT FILE

Symptoms : (Write atleast 3 points)

Treatment : (Write atleast 2/3 points)

Recommended Products : (Give 2 or 3 links)

EXAMPLE TEXT FILE WITH CORRECT FORMAT

Symptoms :
1 : The lesions are dark brown and appear leathery with faint, concentric rings giving a target-spot effect.
2 : At first the spots are small (1 /8 inches in diameter) and oval or angular in shape, but later the spots can enlarge to about 1/2 inches.

Treatment :
1 : Plant only diseasefree, certified seed.
2 : Follow a complete and regular foliar fungicide spray program.
3 : Allow tubers to mature before digging, dig when vines are dry, not wet, and avoid excessive wounding of potatoes during harvesting and handling.

Recommended products :
1 : Harvest-Guard : https://www.planetnatural.com/product/floating-row-cover/
2 : AllDown : https://www.planetnatural.com/product/vinegar-weed-killer/

Make a text file for leaf disease "Tomato__Tomato_YellowLeaf__Curl_Virus"

You should make a text file for this leaf disease and add the symptoms, treatment and recommended products for this leaf disease in leaf disease data folder.

FORMAT OF TEXT FILE

Symptoms : (Write atleast 3 points)

Treatment : (Write atleast 2/3 points)

Recommended Products : (Give 2 or 3 links)

EXAMPLE TEXT FILE WITH CORRECT FORMAT

Symptoms :
1 : The lesions are dark brown and appear leathery with faint, concentric rings giving a target-spot effect.
2 : At first the spots are small (1 /8 inches in diameter) and oval or angular in shape, but later the spots can enlarge to about 1/2 inches.

Treatment :
1 : Plant only diseasefree, certified seed.
2 : Follow a complete and regular foliar fungicide spray program.
3 : Allow tubers to mature before digging, dig when vines are dry, not wet, and avoid excessive wounding of potatoes during harvesting and handling.

Recommended products :
1 : Harvest-Guard : https://www.planetnatural.com/product/floating-row-cover/
2 : AllDown : https://www.planetnatural.com/product/vinegar-weed-killer/

Delete the uploaded image after processing

The uploaded images are currently being saved in test_images folder which is mentioned in .gitignore, you are supposed to run a bash script(.sh) to delete the uploaded image after processing.

Hint : Use rm -f test_images/fileUploadPath command to delete that image.

Share screenshots of successful working of backend [LOCAL SERVER SETUP] [OPEN FOR ALL]

Video Link for Backend Working [Watch this to know better]

This issue is open for all participants. (share screenshots of your backend working)

Follow the given instructions to update your backend repository :

  1. Firstly and most importantly, you need to have node installed in your system, so please go through the README.md file then only you can continue with the below points.
  2. Update your local repository first (git pull upstream master), considering you have named this remote 'upstream'.
  3. Now, do npm install to install the required npm modules and npm install python-shell to install node python shell package.
  4. Go to localhost:3000 and select leaf image to see its category.
  5. Incase you get any ModuleNotFoundError due to imports required in python script then install those module, eg : pip3 install tensorflow will be used to install tensorflow for python 3.x version on your system. You might get other errors as well, do use google and stackoverflow for them, most of them are common errors. If you are still stuck, feel free to pm me on slack.
  6. Once done, add screenshot of your backend logs to the screenshots_folder.

PS : Since, the h5 file size that will get downloaded to your local system will be >100mb, so don't push that file when trying to pull any request for merging, your local cloned repository will otherwise get some irreversible errors. The reason to be cautious of not pushing file>100mb is because maximum project size on github is 100mb, so that is why you will face error when pushing.

PPS : It will take around 15 seconds to get output from the python script, since the model has got quite a complex architecture.

Make a server.js file using express framework

This app starts a server and listens on port 3000 for connections. The app responds with “Hello World!” for requests to the root URL (/) or route. For every other path, it will respond with a 404 Not Found.

Make a text file for leaf disease "Tomato_healthy"

You should make a text file for this leaf disease and add the symptoms, treatment and recommended products for this leaf disease in leaf disease data folder.

FORMAT OF TEXT FILE

Symptoms : (Write atleast 3 points)

Treatment : (Write atleast 2/3 points)

Recommended Products : (Give 2 or 3 links)

EXAMPLE TEXT FILE WITH CORRECT FORMAT

Symptoms :
1 : The lesions are dark brown and appear leathery with faint, concentric rings giving a target-spot effect.
2 : At first the spots are small (1 /8 inches in diameter) and oval or angular in shape, but later the spots can enlarge to about 1/2 inches.

Treatment :
1 : Plant only diseasefree, certified seed.
2 : Follow a complete and regular foliar fungicide spray program.
3 : Allow tubers to mature before digging, dig when vines are dry, not wet, and avoid excessive wounding of potatoes during harvesting and handling.

Recommended products :
1 : Harvest-Guard : https://www.planetnatural.com/product/floating-row-cover/
2 : AllDown : https://www.planetnatural.com/product/vinegar-weed-killer/

Document the whole code

You have to add comments in mainly server.js and index.html file explaining every single line of code. You also have to update README.md file with the project setup instructions. Try to make the code as easily understandable as possible to others. You will have full creative freedom for this issue.

Make a text file for leaf disease "Tomato_Bacterial_spot"

You should make a text file for this leaf disease and add the symptoms, treatment and recommended products for this leaf disease in leaf disease data folder.

FORMAT OF TEXT FILE

Symptoms : (Write atleast 3 points)

Treatment : (Write atleast 2/3 points)

Recommended Products : (Give 2 or 3 links)

EXAMPLE TEXT FILE WITH CORRECT FORMAT

Symptoms :
1 : The lesions are dark brown and appear leathery with faint, concentric rings giving a target-spot effect.
2 : At first the spots are small (1 /8 inches in diameter) and oval or angular in shape, but later the spots can enlarge to about 1/2 inches.

Treatment :
1 : Plant only diseasefree, certified seed.
2 : Follow a complete and regular foliar fungicide spray program.
3 : Allow tubers to mature before digging, dig when vines are dry, not wet, and avoid excessive wounding of potatoes during harvesting and handling.

Recommended products :
1 : Harvest-Guard : https://www.planetnatural.com/product/floating-row-cover/
2 : AllDown : https://www.planetnatural.com/product/vinegar-weed-killer/

Avoid Request Timeout [DEPLOYMENT ISSUE]

If the response time exceeds 30 seconds then output a dummy json (eg. potato healthy)

Observe the error logs : (the output comes after >30 seconds so no response is send even though we have predicted the output just 2-3 seconds after taking 30 seconds)
Screenshot (300)

Although in some cases, it works when obviously the time taken is less than 30 seconds, as we can see in the image below, the response time taken was 25.9 seconds and 29.5 seconds for 2 requests that we send.

Screenshot (301)

Make a text file for leaf disease "Potato___Late_blight"

You should make a text file for this leaf disease and add the symptoms, treatment and recommended products for this leaf disease in leaf disease data folder.

FORMAT OF TEXT FILE

Symptoms : (Write atleast 3 points)

Treatment : (Write atleast 2/3 points)

Recommended Products : (Give 2 or 3 links)

EXAMPLE TEXT FILE WITH CORRECT FORMAT

Symptoms :
1 : The lesions are dark brown and appear leathery with faint, concentric rings giving a target-spot effect.
2 : At first the spots are small (1 /8 inches in diameter) and oval or angular in shape, but later the spots can enlarge to about 1/2 inches.

Treatment :
1 : Plant only diseasefree, certified seed.
2 : Follow a complete and regular foliar fungicide spray program.
3 : Allow tubers to mature before digging, dig when vines are dry, not wet, and avoid excessive wounding of potatoes during harvesting and handling.

Recommended products :
1 : Harvest-Guard : https://www.planetnatural.com/product/floating-row-cover/
2 : AllDown : https://www.planetnatural.com/product/vinegar-weed-killer/

Make a text file for leaf disease "Tomato_Late_blight"

You should make a text file for this leaf disease and add the symptoms, treatment and recommended products for this leaf disease in leaf disease data folder.

FORMAT OF TEXT FILE

Symptoms : (Write atleast 3 points)

Treatment : (Write atleast 2/3 points)

Recommended Products : (Give 2 or 3 links)

EXAMPLE TEXT FILE WITH CORRECT FORMAT

Symptoms :
1 : The lesions are dark brown and appear leathery with faint, concentric rings giving a target-spot effect.
2 : At first the spots are small (1 /8 inches in diameter) and oval or angular in shape, but later the spots can enlarge to about 1/2 inches.

Treatment :
1 : Plant only diseasefree, certified seed.
2 : Follow a complete and regular foliar fungicide spray program.
3 : Allow tubers to mature before digging, dig when vines are dry, not wet, and avoid excessive wounding of potatoes during harvesting and handling.

Recommended products :
1 : Harvest-Guard : https://www.planetnatural.com/product/floating-row-cover/
2 : AllDown : https://www.planetnatural.com/product/vinegar-weed-killer/

Add icon logo for the website

Inside the <head> tag add logo of website using the <link> tag. The logo is same as this organisation's github logo.

Make a text file for leaf disease "Tomato_Septoria_leaf_spot"

You should make a text file for this leaf disease and add the symptoms, treatment and recommended products for this leaf disease in leaf disease data folder.

FORMAT OF TEXT FILE

Symptoms : (Write atleast 3 points)

Treatment : (Write atleast 2/3 points)

Recommended Products : (Give 2 or 3 links)

EXAMPLE TEXT FILE WITH CORRECT FORMAT

Symptoms :
1 : The lesions are dark brown and appear leathery with faint, concentric rings giving a target-spot effect.
2 : At first the spots are small (1 /8 inches in diameter) and oval or angular in shape, but later the spots can enlarge to about 1/2 inches.

Treatment :
1 : Plant only diseasefree, certified seed.
2 : Follow a complete and regular foliar fungicide spray program.
3 : Allow tubers to mature before digging, dig when vines are dry, not wet, and avoid excessive wounding of potatoes during harvesting and handling.

Recommended products :
1 : Harvest-Guard : https://www.planetnatural.com/product/floating-row-cover/
2 : AllDown : https://www.planetnatural.com/product/vinegar-weed-killer/

Make a text file for leaf disease "Tomato_Early_blight"

You should make a text file for this leaf disease and add the symptoms, treatment and recommended products for this leaf disease in leaf disease data folder.

FORMAT OF TEXT FILE

Symptoms : (Write atleast 3 points)

Treatment : (Write atleast 2/3 points)

Recommended Products : (Give 2 or 3 links)

EXAMPLE TEXT FILE WITH CORRECT FORMAT

Symptoms :
1 : The lesions are dark brown and appear leathery with faint, concentric rings giving a target-spot effect.
2 : At first the spots are small (1 /8 inches in diameter) and oval or angular in shape, but later the spots can enlarge to about 1/2 inches.

Treatment :
1 : Plant only diseasefree, certified seed.
2 : Follow a complete and regular foliar fungicide spray program.
3 : Allow tubers to mature before digging, dig when vines are dry, not wet, and avoid excessive wounding of potatoes during harvesting and handling.

Recommended products :
1 : Harvest-Guard : https://www.planetnatural.com/product/floating-row-cover/
2 : AllDown : https://www.planetnatural.com/product/vinegar-weed-killer/

Make a text file for leaf disease "Tomato__Target_Spot"

You should make a text file for this leaf disease and add the symptoms, treatment and recommended products for this leaf disease in leaf disease data folder.

FORMAT OF TEXT FILE

Symptoms : (Write atleast 3 points)

Treatment : (Write atleast 2/3 points)

Recommended Products : (Give 2 or 3 links)

EXAMPLE TEXT FILE WITH CORRECT FORMAT

Symptoms :
1 : The lesions are dark brown and appear leathery with faint, concentric rings giving a target-spot effect.
2 : At first the spots are small (1 /8 inches in diameter) and oval or angular in shape, but later the spots can enlarge to about 1/2 inches.

Treatment :
1 : Plant only diseasefree, certified seed.
2 : Follow a complete and regular foliar fungicide spray program.
3 : Allow tubers to mature before digging, dig when vines are dry, not wet, and avoid excessive wounding of potatoes during harvesting and handling.

Recommended products :
1 : Harvest-Guard : https://www.planetnatural.com/product/floating-row-cover/
2 : AllDown : https://www.planetnatural.com/product/vinegar-weed-killer/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.