Aarzoo-Singh2206 commited on
Commit
3c7a8b5
Β·
verified Β·
1 Parent(s): 0062006

Upload 6 files

Browse files
Files changed (7) hide show
  1. .gitattributes +2 -0
  2. 0021_0060.JPG +3 -0
  3. README.md +23 -12
  4. app.py +47 -0
  5. efficientnet_model.keras +3 -0
  6. examples.zip +3 -0
  7. requirements.txt +4 -0
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ 0021_0060.JPG filter=lfs diff=lfs merge=lfs -text
37
+ efficientnet_model.keras filter=lfs diff=lfs merge=lfs -text
0021_0060.JPG ADDED

Git LFS Details

  • SHA256: 274b9a1a42039da727db4a089d502503df227848e8171f31bda755a7344c259a
  • Pointer size: 132 Bytes
  • Size of remote file: 1.54 MB
README.md CHANGED
@@ -1,12 +1,23 @@
1
- ---
2
- title: Codeblock
3
- emoji: πŸ†
4
- colorFrom: purple
5
- colorTo: purple
6
- sdk: gradio
7
- sdk_version: 5.34.2
8
- app_file: app.py
9
- pinned: false
10
- ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # πŸƒ Plant Disease Detector
2
+
3
+ This is a Gradio demo of a fruit and leaf disease classification model trained using EfficientNetB0.
4
+
5
+ ## 🧠 Model
6
+ - Architecture: EfficientNetB0
7
+ - Input Size: 160x160
8
+ - Classes: 21 different fruit and leaf disease types
9
+ - Trained using TensorFlow / Keras
10
+ - Accuracy: ~99.5% (train), ~98.5% (val)
11
+
12
+ ## πŸ–ΌοΈ Usage
13
+ Upload an image of a fruit or leaf, and the model will predict its disease type.
14
+
15
+ ## πŸ§ͺ Example Images
16
+ You can use sample images provided in the `examples/` folder.
17
+
18
+ ## πŸ”§ Requirements
19
+ All dependencies are listed in `requirements.txt`.
20
+
21
+ ## πŸ™‹β€β™‚οΈ Author
22
+ **Aarzoo Singh**, Research Intern
23
+ B.Tech CSE, NIT Patna
app.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import tensorflow as tf
3
+ from tensorflow.keras.applications.efficientnet import preprocess_input
4
+ from tensorflow.keras.preprocessing import image
5
+ import numpy as np
6
+
7
+ model = tf.keras.models.load_model("efficientnet_final_model.keras")
8
+
9
+ CLASS_NAMES = [
10
+ "Pomegranate__diseased", "mango_Sooty Mould", "mango_Powdery Mildew",
11
+ "mango_Healthy", "mango_Gall Midge", "mango_Die Back",
12
+ "mango_Cutting Weevil", "mango_Bacterial Canker", "mango_Anthracnose",
13
+ "guava_Healthy", "guava_Red Rust", "guava_Sooty Mould",
14
+ "guava_Algal Leaf Spot", "guava_Rust", "lime_Greening",
15
+ "lime_Canker", "lime_Healthy", "lime_Die Back",
16
+ "lime_Scab", "lime_Anthracnose", "lime_Sooty Mould"
17
+ ]
18
+
19
+ def predict_disease(img):
20
+ img = img.resize((160, 160))
21
+ img_array = image.img_to_array(img)
22
+ img_array = preprocess_input(img_array)
23
+ img_array = np.expand_dims(img_array, axis=0)
24
+
25
+ prediction = model.predict(img_array)[0]
26
+ top_idx = np.argmax(prediction)
27
+ confidence = prediction[top_idx] * 100
28
+ label = CLASS_NAMES[top_idx]
29
+
30
+ return f"{label} ({confidence:.2f}%)"
31
+
32
+ interface = gr.Interface(
33
+ fn=predict_disease,
34
+ inputs=gr.Image(type="pil"),
35
+ outputs="text",
36
+ title="Fruit Leaf Disease Classifier 🌿",
37
+ description="Upload an image of a fruit/leaf and the model will classify the disease type.",
38
+ examples=[
39
+ ["examples/Phytopthora.jpg"],
40
+ ["examples/RedRust.jpg"],
41
+ ["examples/HealthyMangoLeaf.jpg"],
42
+ ["examples/LimeLeafSpotted.jpg"]
43
+ ]
44
+ )
45
+
46
+ if __name__ == "__main__":
47
+ interface.launch()
efficientnet_model.keras ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b2d5c4af1e257e80878b77f89b5f1d3c4f392701af69c3205e2f55884bc13e85
3
+ size 28183873
examples.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4b0871b2f0d7040dc6f139362f5cc6fded0771c34da386a4208705d5ca1a06d3
3
+ size 1567599
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ gradio
2
+ tensorflow
3
+ numpy
4
+ pillow