Regino commited on
Commit
97de020
Β·
1 Parent(s): 2763fea

shdbfsjdbf

Browse files
Files changed (1) hide show
  1. app.py +23 -6
app.py CHANGED
@@ -107,18 +107,34 @@ elif page == "Model Metrics":
107
  except:
108
  st.error("🚨 Model metrics files (`y_true.pth` and `y_pred.pth`) not found!")
109
 
110
- # βœ… Disease Predictor Page
111
  elif page == "Disease Predictor":
112
  st.title("🌿 Plant Disease Classifier")
113
-
114
- # File Upload
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  uploaded_file = st.file_uploader("Upload a plant leaf image", type=["jpg", "png", "jpeg"])
116
 
117
  if uploaded_file is not None:
118
  image = Image.open(uploaded_file)
119
  st.image(image, caption="Uploaded Image", use_column_width=True)
120
 
121
- # Transform Image
122
  transform = transforms.Compose([
123
  transforms.Resize((128, 128)),
124
  transforms.ToTensor(),
@@ -127,9 +143,10 @@ elif page == "Disease Predictor":
127
 
128
  image_tensor = transform(image).unsqueeze(0)
129
 
130
- # Predict Disease
131
  with torch.no_grad():
132
  output = model(image_tensor)
133
  predicted_class = torch.argmax(output, dim=1).item()
134
 
135
- st.write(f"### βœ… Prediction: {CLASS_NAMES[predicted_class]}")
 
 
107
  except:
108
  st.error("🚨 Model metrics files (`y_true.pth` and `y_pred.pth`) not found!")
109
 
110
+ ## βœ… Disease Predictor Page
111
  elif page == "Disease Predictor":
112
  st.title("🌿 Plant Disease Classifier")
113
+
114
+ # βœ… App Overview
115
+ st.write("""
116
+ This app uses a deep learning model to detect plant diseases from leaf images.
117
+ Upload a clear image of a plant leaf, and the model will predict the disease it might have.
118
+
119
+ ### 🏷️ Supported Plant Diseases:
120
+ - Early Blight
121
+ - Late Blight
122
+ - Leaf Mold
123
+ - Powdery Mildew
124
+ - Rust
125
+ - Target Spot
126
+ - Yellow Leaf Curl Virus
127
+ - Healthy (No Disease)
128
+ """)
129
+
130
+ # βœ… File Upload
131
  uploaded_file = st.file_uploader("Upload a plant leaf image", type=["jpg", "png", "jpeg"])
132
 
133
  if uploaded_file is not None:
134
  image = Image.open(uploaded_file)
135
  st.image(image, caption="Uploaded Image", use_column_width=True)
136
 
137
+ # βœ… Transform Image
138
  transform = transforms.Compose([
139
  transforms.Resize((128, 128)),
140
  transforms.ToTensor(),
 
143
 
144
  image_tensor = transform(image).unsqueeze(0)
145
 
146
+ # βœ… Predict Disease
147
  with torch.no_grad():
148
  output = model(image_tensor)
149
  predicted_class = torch.argmax(output, dim=1).item()
150
 
151
+ st.write(f"### βœ… Prediction: **{CLASS_NAMES[predicted_class]}**")
152
+ st.success("βœ” The prediction is based on a trained deep learning model.")