{"id":18237481,"url":"https://github.com/alrescha79-cmd/flask-tf-api","last_synced_at":"2026-02-16T10:39:03.912Z","repository":{"id":259005211,"uuid":"875447585","full_name":"alrescha79-cmd/flask-tf-api","owner":"alrescha79-cmd","description":"A simple REST API built with Flask that uses a TensorFlow model to predict corn leaf diseases. This API accepts images of corn leaves, processes them, and returns the predicted class along with the prediction confidence.","archived":false,"fork":false,"pushed_at":"2024-10-23T13:21:20.000Z","size":99184,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-06T00:59:48.407Z","etag":null,"topics":["cnn","flask","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","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/alrescha79-cmd.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,"publiccode":null,"codemeta":null}},"created_at":"2024-10-20T02:15:36.000Z","updated_at":"2025-03-02T12:11:29.000Z","dependencies_parsed_at":"2025-02-14T11:58:28.945Z","dependency_job_id":null,"html_url":"https://github.com/alrescha79-cmd/flask-tf-api","commit_stats":null,"previous_names":["alrescha79-cmd/flask-tf-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alrescha79-cmd/flask-tf-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alrescha79-cmd%2Fflask-tf-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alrescha79-cmd%2Fflask-tf-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alrescha79-cmd%2Fflask-tf-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alrescha79-cmd%2Fflask-tf-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alrescha79-cmd","download_url":"https://codeload.github.com/alrescha79-cmd/flask-tf-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alrescha79-cmd%2Fflask-tf-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29506253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T09:05:14.864Z","status":"ssl_error","status_checked_at":"2026-02-16T08:55:59.364Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cnn","flask","tensorflow"],"created_at":"2024-11-05T02:04:43.307Z","updated_at":"2026-02-16T10:39:03.874Z","avatar_url":"https://github.com/alrescha79-cmd.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask TensorFlow API for Corn Leaf Disease Detection\n\nA simple REST API built with Flask that uses a TensorFlow model to predict corn leaf diseases. This API accepts images of corn leaves, processes them, and returns the predicted class along with the prediction confidence.\n\n## Dataset\n\n[Kaggle](https://www.kaggle.com/datasets/smaranjitghose/corn-or-maize-leaf-disease-dataset)\n\n## Features\n\n- Upload an image of a corn leaf and get a disease prediction.\n- Supports multiple classes: Blight, Common Rust, Gray Leaf Spot, and Healthy.\n- Easily deployable with minimal dependencies.\n\n## Prerequisites\n\n- Python 3.8 or higher\n- Virtual environment (recommended)\n\n## Installation\n\n### Clone the Repository\n\n ```bash\n   git clone https://github.com/alrescha79-cmd/flask-tf-api.git\n```\n\n#### change directory\n\n```bash\n    cd flask-tf-api\n```\n\n### Create a Virtual Environment\n\n```bash\npython -m venv venv\n```\n\n#### For Linux/MacOS\n\n```bash\nsource venv/bin/activate \n```\n\n##### For Windows\n\n```bash\nvenv\\Scripts\\activate \n```\n\n### Install Required Packages\n\n```bash\npip install -r requirements.txt\n```\n\n## Usage/Examples\n\n### Start the API\n\nRun the Flask server with the following command:\n\n```bash\npython app.py\n```\n\nBy default, the server will start on \u003chttp://localhost:5000\u003e.\n\n### Make a Prediction\n\nUse curl or tools like Postman to send a POST request to the /predict endpoint with an image file:\n\n```bash\ncurl -X POST -F 'file=@/path/to/your/image.jpg' http://localhost:5000/predict\n```\n\nReplace `/path/to/your/image.jpg` with the path to your image file. The API will return a JSON response containing the predicted class and its confidence percentage.\n\n### Example Response\n\nAfter sending a request with an image, you should receive a JSON response like this:\n\n```json\n{\n    \"predicted_class\": \"Common_Rust\",\n    \"predicted_percentage\": \"78.11%\",\n    \"probabilities\": {\n        \"Blight\": \"6.51%\",\n        \"Common_Rust\": \"78.11%\",\n        \"Gray_Leaf_Spot\": \"14.92%\",\n        \"Healthy\": \"0.46%\"\n    },\n    \"success\": true\n}\n```\n\n## Notes\n\nMake sure model.h5 is placed in the `model/model.h5` directory or update the model path in the code.\n\nAdjust the image preprocessing size if your model requires a different input size.\n\n*This model.h5 still does not have perfect accuracy because this is only an example.*\n\n## Acknowledgements\n\nTensorFlow for providing a powerful framework for deep learning.\n\nFlask for making it easy to create APIs.\n\nThe agricultural community for contributing datasets of corn leaf diseases.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falrescha79-cmd%2Fflask-tf-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falrescha79-cmd%2Fflask-tf-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falrescha79-cmd%2Fflask-tf-api/lists"}