Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -16,12 +16,12 @@ vit_model = ViTForImageClassification.from_pretrained(
|
|
16 |
)
|
17 |
|
18 |
vit_label_treatment = {
|
19 |
-
|
20 |
"Corn___Common_rust": "Use recommended fungicides and ensure crop rotation.",
|
21 |
"Corn___Cercospora_leaf_spot": "Apply foliar fungicides; ensure good field sanitation.",
|
22 |
"Potato___Early_blight": "Apply preventive fungicides; remove infected debris.",
|
23 |
"Potato___Late_blight": "Use certified seed tubers; fungicide sprays when conditions favor disease.",
|
24 |
"Rice___Leaf_blight": "Use resistant rice varieties, maintain field hygiene.",
|
|
|
25 |
"Wheat___Leaf_rust": "Plant resistant wheat varieties, apply foliar fungicides if severe.",
|
26 |
# Fallback
|
27 |
"Unknown": "No specific treatment available."
|
@@ -188,7 +188,7 @@ def main_model_selector(model_choice, image):
|
|
188 |
"""
|
189 |
Dispatch function based on user choice of model:
|
190 |
- 'Vit-model (Corn/Potato/Rice/Wheat)' -> use classify_image_vit
|
191 |
-
- 'Keras-model (Apple/Blueberry/Cherry
|
192 |
"""
|
193 |
if image is None:
|
194 |
return "No image provided.", None, None, None
|
|
|
16 |
)
|
17 |
|
18 |
vit_label_treatment = {
|
|
|
19 |
"Corn___Common_rust": "Use recommended fungicides and ensure crop rotation.",
|
20 |
"Corn___Cercospora_leaf_spot": "Apply foliar fungicides; ensure good field sanitation.",
|
21 |
"Potato___Early_blight": "Apply preventive fungicides; remove infected debris.",
|
22 |
"Potato___Late_blight": "Use certified seed tubers; fungicide sprays when conditions favor disease.",
|
23 |
"Rice___Leaf_blight": "Use resistant rice varieties, maintain field hygiene.",
|
24 |
+
"Rice___Brown_spot": "For brown spot of rice, employ integrated disease management practices. Use disease-resistant rice varieties and ensure balanced fertilization to prevent excessive nitrogen, which can predispose plants to infection. Optimize irrigation to maintain proper moisture levels and avoid water stress. At the first signs of brown spot, apply fungicides such as carbendazim or validamycin according to label recommendations. Additionally, remove and destroy infected residues to reduce pathogen inoculum and consider crop rotation to minimize disease recurrence.",
|
25 |
"Wheat___Leaf_rust": "Plant resistant wheat varieties, apply foliar fungicides if severe.",
|
26 |
# Fallback
|
27 |
"Unknown": "No specific treatment available."
|
|
|
188 |
"""
|
189 |
Dispatch function based on user choice of model:
|
190 |
- 'Vit-model (Corn/Potato/Rice/Wheat)' -> use classify_image_vit
|
191 |
+
- 'Keras-model (Apple/Blueberry/Cherry, etc.)' -> use classify_and_visualize_keras
|
192 |
"""
|
193 |
if image is None:
|
194 |
return "No image provided.", None, None, None
|