https://github.com/kylehperez/mushroomnet
This API is for research purposes ONLY and is NOT to be used for food-safety or medical advice. Mushroomnet is a machine learning neural network for classifying mushrooms as poisonous or edible. The model was trained on data from uni.edu: over 5,000 instances of mushrooms, with 22 qualitative features and a determination of poisonous or edible.
https://github.com/kylehperez/mushroomnet
artificial-intelligence botany flask-api machine-learning mycology neural-network numpy python3 pytorch scikit-learn
Last synced: about 2 months ago
JSON representation
This API is for research purposes ONLY and is NOT to be used for food-safety or medical advice. Mushroomnet is a machine learning neural network for classifying mushrooms as poisonous or edible. The model was trained on data from uni.edu: over 5,000 instances of mushrooms, with 22 qualitative features and a determination of poisonous or edible.
- Host: GitHub
- URL: https://github.com/kylehperez/mushroomnet
- Owner: KyleHPerez
- Created: 2025-06-08T17:26:06.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-06-15T18:41:47.000Z (4 months ago)
- Last Synced: 2025-06-15T18:59:17.655Z (4 months ago)
- Topics: artificial-intelligence, botany, flask-api, machine-learning, mycology, neural-network, numpy, python3, pytorch, scikit-learn
- Language: Python
- Homepage:
- Size: 165 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mushroomnet
Mushroomnet is a machine learning neural network for classifying mushrooms as poisonous or edible. The model was trained on data from uni.edu: over 5,000 instances of mushrooms, each with 22 qualitative features and a determination of poisonous or edible.ATTENTION! This API is for research purposes only and is NOT to be used for food-safety or medical advice.
GENERAL DESCRIPTION
The code here was written by myself (Kyle Hunter Perez) on 8 June 2025 as an experiment in learning neural network (NN) machine learning (ML) / artificial intelligence (AI) with Python. I used ChatGPT (version 4o) to first prepare a basic understanding of relevant topics in Python and the math underpinning those operations. I then directed and supervised ChatGPT 4o to incrementally build code in line with my vision for a simple NN model trained on high-fidelity, under-utilizied data (here, the data set of Agraricus lepiota measurements from UCI.edu) implemented with PyTorch, scikit-learn, pandas, and numpy. I directed code adjustments until a fully functional and deployable API running on Flask and reachable with curl was complete. In the process, I gained hands-on experience working with Python for NN ML/AI, using conventional libraries in that field, deploying the product service, and familiarity with how the code works and the mathematics that run under-the-hood.WEBSITE
Use mushroomnet with a basic web UI at https://kylehperez.github.io/mushroomnet/
Select values for each of the features and press 'submit' to get a prediction for a sample matching that data.
There are some feature values that did not appear in the dataset, so for those few, the model will not recognize them and will not return a prediction.
I am working on identifying which values those are and removing them from the dropdown menu to avoid confusion.CLOUD SERVICE
Mushroomnet is now cloud-hosted via Fly.io at https://mushroomnet.fly.dev/. See below (Docker section, point 6) for a sample curl http request to send to the API.DOCKER
This repository contains support files for running mushroomnet as a containerized API with Docker.
To run mushroomnet inside a Docker container:
1. (If you haven't already) download and install Docker https://docs.docker.com/desktop/setup/install/mac-install/
2. Change your working directory to the folder with the mushroomnet source code files (e.g. cd /home/users/me/Documents/mushroomnet )
3. From your command line, docker build -t mushroom-api .
4. Then, also from your command line, docker run -p 8000:5000 mushroom-api
5. Now you have a container running mushroomnet that you can reach at 127.0.0.1:8000
6. (Optional) test the API by sending a sample request:
curl -X POST http://127.0.0.1:8000/predict \
-H "Content-Type: application/json" \
-d '{"features": {"cap-shape": "x", "cap-surface": "s", "cap-color": "n", "bruises": "t", "odor": "p", "gill-attachment": "f", "gill-spacing": "c", "gill-size": "n", "gill-color": "k", "stalk-shape": "e", "stalk-root": "e", "stalk-surface-above-ring": "s", "stalk-surface-below-ring": "s", "stalk-color-above-ring": "w", "stalk-color-below-ring": "w", "veil-type": "p", "veil-color": "w", "ring-number": "o", "ring-type": "p", "spore-print-color": "k", "population": "s", "habitat": "u"}}'Have fun!
And remember, mushroomnet is only for research/entertainment purposes. DO NOT use mushroomnet for food-safety or medical advice.NEXT STEPS
Identify feature values that did not appear in the data set (and which the model does not recognize).
Add confidence reporting to the web UI.
Style the web UI.LINKS
Source for mushroom dataset: https://archive.ics.uci.edu/ml/machine-learning-databases/mushroom/agaricus-lepiota.data
Website interface for mushroomnet https://kylehperez.github.io/mushroomnet/