{"id":27044266,"url":"https://github.com/igopalakrishna/potato-disease-classification","last_synced_at":"2025-04-05T05:28:51.670Z","repository":{"id":222509531,"uuid":"757489111","full_name":"igopalakrishna/potato-disease-classification","owner":"igopalakrishna","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-14T15:54:38.000Z","size":19946,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-02-14T16:51:39.044Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/igopalakrishna.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-14T15:48:02.000Z","updated_at":"2024-02-14T16:51:41.103Z","dependencies_parsed_at":"2024-02-14T17:01:44.975Z","dependency_job_id":null,"html_url":"https://github.com/igopalakrishna/potato-disease-classification","commit_stats":null,"previous_names":["igopalakrishna/potato-disease-classification"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igopalakrishna%2Fpotato-disease-classification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igopalakrishna%2Fpotato-disease-classification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igopalakrishna%2Fpotato-disease-classification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igopalakrishna%2Fpotato-disease-classification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/igopalakrishna","download_url":"https://codeload.github.com/igopalakrishna/potato-disease-classification/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247292983,"owners_count":20915153,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-05T05:28:51.032Z","updated_at":"2025-04-05T05:28:51.658Z","avatar_url":"https://github.com/igopalakrishna.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Potato Disease Classification\n\n## Setup for Python:\n\n1. Install Python ([Setup instructions](https://wiki.python.org/moin/BeginnersGuide))\n\n2. Install Python packages\n\n```\npip3 install -r training/requirements.txt\npip3 install -r api/requirements.txt\n```\n\n3. Install Tensorflow Serving ([Setup instructions](https://www.tensorflow.org/tfx/serving/setup))\n\n## Setup for ReactJS\n\n1. Install Nodejs ([Setup instructions](https://nodejs.org/en/download/package-manager/))\n2. Install NPM ([Setup instructions](https://www.npmjs.com/get-npm))\n3. Install dependencies\n\n```bash\ncd frontend\nnpm install --from-lock-json\nnpm audit fix\n```\n\n4. Copy `.env.example` as `.env`.\n\n5. Change API url in `.env`.\n\n## Setup for React-Native app\n\n1. Go to the [React Native environment setup](https://reactnative.dev/docs/environment-setup), then select `React Native CLI Quickstart` tab.  \n\n2. Install dependencies\n\n```bash\ncd mobile-app\nyarn install\n```\n\n  - 2.1 Only for mac users\n```bash\ncd ios \u0026\u0026 pod install \u0026\u0026 cd ../\n```\n\n3. Copy `.env.example` as `.env`.\n\n4. Change API url in `.env`.\n\n## Training the Model\n\n1. Download the data from [kaggle](https://www.kaggle.com/arjuntejaswi/plant-village).\n2. Only keep folders related to Potatoes.\n3. Run Jupyter Notebook in Browser.\n\n```bash\njupyter notebook\n```\n\n4. Open `training/potato-disease-training.ipynb` in Jupyter Notebook.\n5. In cell #2, update the path to dataset.\n6. Run all the Cells one by one.\n7. Copy the model generated and save it with the version number in the `models` folder.\n\n## Running the API\n\n### Using FastAPI\n\n1. Get inside `api` folder\n\n```bash\ncd api\n```\n\n2. Run the FastAPI Server using uvicorn\n\n```bash\nuvicorn main:app --reload --host 0.0.0.0\n```\n\n3. Your API is now running at `0.0.0.0:8000`\n\n### Using FastAPI \u0026 TF Serve\n\n1. Get inside `api` folder\n\n```bash\ncd api\n```\n\n2. Copy the `models.config.example` as `models.config` and update the paths in file.\n3. Run the TF Serve (Update config file path below)\n\n```bash\ndocker run -t --rm -p 8501:8501 -v C:/Code/potato-disease-classification:/potato-disease-classification tensorflow/serving --rest_api_port=8501 --model_config_file=/potato-disease-classification/models.config\n```\n\n4. Run the FastAPI Server using uvicorn\n   For this you can directly run it from your main.py or main-tf-serving.py using pycharm run option (as shown in the video tutorial)\n   OR you can run it from command prompt as shown below,\n\n```bash\nuvicorn main-tf-serving:app --reload --host 0.0.0.0\n```\n\n5. Your API is now running at `0.0.0.0:8000`\n\n## Running the Frontend\n\n1. Get inside `api` folder\n\n```bash\ncd frontend\n```\n\n2. Copy the `.env.example` as `.env` and update `REACT_APP_API_URL` to API URL if needed.\n3. Run the frontend\n\n```bash\nnpm run start\n```\n\n## Running the app\n\n1. Get inside `mobile-app` folder\n\n```bash\ncd mobile-app\n```\n\n2. Copy the `.env.example` as `.env` and update `URL` to API URL if needed.\n\n3. Run the app (android/iOS)\n\n```bash\nnpm run android\n```\n\nor\n\n```bash\nnpm run ios\n```\n\n4. Creating public ([signed APK](https://reactnative.dev/docs/signed-apk-android))\n\n\n## Creating the TF Lite Model\n\n1. Run Jupyter Notebook in Browser.\n\n```bash\njupyter notebook\n```\n\n2. Open `training/tf-lite-converter.ipynb` in Jupyter Notebook.\n3. In cell #2, update the path to dataset.\n4. Run all the Cells one by one.\n5. Model would be saved in `tf-lite-models` folder.\n\n## Deploying the TF Lite on GCP\n\n1. Create a [GCP account](https://console.cloud.google.com/freetrial/signup/tos?_ga=2.25841725.1677013893.1627213171-706917375.1627193643\u0026_gac=1.124122488.1627227734.Cj0KCQjwl_SHBhCQARIsAFIFRVVUZFV7wUg-DVxSlsnlIwSGWxib-owC-s9k6rjWVaF4y7kp1aUv5eQaAj2kEALw_wcB).\n2. Create a [Project on GCP](https://cloud.google.com/appengine/docs/standard/nodejs/building-app/creating-project) (Keep note of the project id).\n3. Create a [GCP bucket](https://console.cloud.google.com/storage/browser/).\n4. Upload the potatoes.h5 model in the bucket in the path `models/potatos.h5`.\n5. Install Google Cloud SDK ([Setup instructions](https://cloud.google.com/sdk/docs/quickstarts)).\n6. Authenticate with Google Cloud SDK.\n\n```bash\ngcloud auth login\n```\n\n7. Run the deployment script.\n\n```bash\ncd gcp\ngcloud functions deploy predict_lite --runtime python38 --trigger-http --memory 512 --project project_id\n```\n\n8. Your model is now deployed.\n9. Use Postman to test the GCF using the [Trigger URL](https://cloud.google.com/functions/docs/calling/http).\n\nInspiration: https://cloud.google.com/blog/products/ai-machine-learning/how-to-serve-deep-learning-models-using-tensorflow-2-0-with-cloud-functions\n\n## Deploying the TF Model (.h5) on GCP\n\n1. Create a [GCP account](https://console.cloud.google.com/freetrial/signup/tos?_ga=2.25841725.1677013893.1627213171-706917375.1627193643\u0026_gac=1.124122488.1627227734.Cj0KCQjwl_SHBhCQARIsAFIFRVVUZFV7wUg-DVxSlsnlIwSGWxib-owC-s9k6rjWVaF4y7kp1aUv5eQaAj2kEALw_wcB).\n2. Create a [Project on GCP](https://cloud.google.com/appengine/docs/standard/nodejs/building-app/creating-project) (Keep note of the project id).\n3. Create a [GCP bucket](https://console.cloud.google.com/storage/browser/).\n4. Upload the tf .h5 model generate in the bucket in the path `models/potato-model.h5`.\n5. Install Google Cloud SDK ([Setup instructions](https://cloud.google.com/sdk/docs/quickstarts)).\n6. Authenticate with Google Cloud SDK.\n\n```bash\ngcloud auth login\n```\n\n7. Run the deployment script.\n\n```bash\ncd gcp\ngcloud functions deploy predict --runtime python38 --trigger-http --memory 512 --project project_id\n```\n\n8. Your model is now deployed.\n9. Use Postman to test the GCF using the [Trigger URL](https://cloud.google.com/functions/docs/calling/http).\n\nInspiration: https://cloud.google.com/blog/products/ai-machine-learning/how-to-serve-deep-learning-models-using-tensorflow-2-0-with-cloud-functions\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figopalakrishna%2Fpotato-disease-classification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figopalakrishna%2Fpotato-disease-classification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figopalakrishna%2Fpotato-disease-classification/lists"}