saritha commited on
Commit
890db39
·
verified ·
1 Parent(s): 4316bfd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -23
app.py CHANGED
@@ -48,7 +48,7 @@ def get_response_llm(predicted_label,knowledge_base):
48
  response = model.generate_content([prompt])
49
  return response.text
50
 
51
- # Knowledge base for sugarcane diseases (example data from the website)
52
  # Comprehensive knowledge base for sugarcane diseases and practices
53
  knowledge_base = """
54
  'BacterialBlights': Bacterial blights are caused by *Xanthomonas albilineans*.
@@ -60,9 +60,9 @@ knowledge_base = """
60
  **Management:**
61
  - Apply copper-based fungicides.
62
  - Improve field drainage to avoid waterlogging.
63
- - Use disease-free planting material.""",
64
 
65
- 'Mosaic': """Mosaic disease is caused by the Sugarcane mosaic virus (SCMV) and often transmitted by aphids.
66
  **Symptoms:**
67
  - Mottled appearance on leaves with streaks of yellow and green.
68
  - Reduced photosynthetic efficiency.
@@ -71,9 +71,9 @@ knowledge_base = """
71
  **Management:**
72
  - Use resistant sugarcane varieties.
73
  - Control aphid populations with insecticides.
74
- - Remove and destroy infected plants to prevent spread.""",
75
 
76
- 'RedRot': """Red rot is caused by the fungus *Colletotrichum falcatum*.
77
  **Symptoms:**
78
  - Red streaks inside the cane with white patches.
79
  - Rotting of the stalk, emitting a sour smell.
@@ -82,9 +82,9 @@ knowledge_base = """
82
  **Management:**
83
  - Plant resistant varieties.
84
  - Remove and burn infected plants.
85
- - Treat soil with fungicides and practice crop rotation.""",
86
 
87
- 'Rust': """Rust is caused by the fungus *Puccinia melanocephala*.
88
  **Symptoms:**
89
  - Formation of orange to reddish pustules on leaves.
90
  - Premature drying of leaves.
@@ -93,9 +93,9 @@ knowledge_base = """
93
  **Management:**
94
  - Apply systemic fungicides (e.g., triazoles).
95
  - Ensure proper field hygiene.
96
- - Avoid water stress and maintain balanced nutrition.""",
97
 
98
- 'Yellow': """Yellowing can be caused by nutrient deficiencies or disease onset.
99
  **Symptoms:**
100
  - Yellowing of leaf tips or entire leaves.
101
  - Reduced photosynthesis and growth.
@@ -103,9 +103,9 @@ knowledge_base = """
103
  **Management:**
104
  - Conduct soil testing to identify deficiencies.
105
  - Apply balanced fertilizers as per soil nutrient status.
106
- - Maintain proper irrigation schedules.""",
107
 
108
- 'Smut': """Smut is caused by the fungus *Sporisorium scitamineum*.
109
  **Symptoms:**
110
  - Formation of whip-like structures at the growing points.
111
  - Stunted growth and tiller proliferation.
@@ -114,31 +114,33 @@ knowledge_base = """
114
  **Management:**
115
  - Plant smut-resistant varieties.
116
  - Remove smut-infected plants.
117
- - Treat seed sets with fungicides before planting.""",
118
 
119
- 'Healthy': """The sugarcane crop is healthy.
120
  Continue regular monitoring and follow good agronomic practices:
121
  - Ensure balanced fertilization.
122
  - Maintain proper irrigation schedules.
123
- - Monitor for pests and diseases regularly.""",
124
-
125
- 'GeneralPractices': """**General Practices for Disease Prevention**
126
  - **Field Sanitation:** Remove and destroy crop residues and infected plants to reduce inoculum levels.
127
  - **Resistant Varieties:** Cultivate sugarcane varieties that are resistant to specific diseases.
128
  - **Seed Treatment:** Use disease-free, certified seed material. Treat seed sets with fungicides before planting.
129
  - **Crop Rotation:** Rotate sugarcane with non-host crops to break the disease cycle.
130
  - **Optimal Agronomic Practices:** Ensure proper irrigation and drainage. Maintain balanced fertilization and avoid over-application of nitrogen.
131
  - **Timely Monitoring and Control:** Inspect fields regularly for symptoms. Apply recommended fungicides or bactericides as soon as symptoms appear.
132
- - **Integrated Pest and Disease Management (IPDM):** Combine biological, chemical, and cultural methods to manage diseases sustainably.""",
133
-
134
- 'ImpactOfDiseases': """**Impact of Sugarcane Diseases**
135
  - **Yield Reduction:** Diseases like red rot and smut can reduce cane yield by 30–60%.
136
  - **Quality Degradation:** Affected plants produce less sugar and lower-quality juice.
137
- - **Economic Losses:** Increased cost of management and reduced marketable output affect profitability.""",
138
-
139
- 'SugarcaneOverview': """Sugarcane is a critical crop globally, providing raw materials for sugar, ethanol, and other byproducts.
140
  However, it is susceptible to various diseases caused by fungi, bacteria, viruses, and environmental factors.
141
- Effective management practices are essential to ensure high yield and quality."""
 
 
142
 
143
 
144
  # Update the predict_disease function
 
48
  response = model.generate_content([prompt])
49
  return response.text
50
 
51
+
52
  # Comprehensive knowledge base for sugarcane diseases and practices
53
  knowledge_base = """
54
  'BacterialBlights': Bacterial blights are caused by *Xanthomonas albilineans*.
 
60
  **Management:**
61
  - Apply copper-based fungicides.
62
  - Improve field drainage to avoid waterlogging.
63
+ - Use disease-free planting material.,
64
 
65
+ 'Mosaic': Mosaic disease is caused by the Sugarcane mosaic virus (SCMV) and often transmitted by aphids.
66
  **Symptoms:**
67
  - Mottled appearance on leaves with streaks of yellow and green.
68
  - Reduced photosynthetic efficiency.
 
71
  **Management:**
72
  - Use resistant sugarcane varieties.
73
  - Control aphid populations with insecticides.
74
+ - Remove and destroy infected plants to prevent spread.,
75
 
76
+ 'RedRot': Red rot is caused by the fungus *Colletotrichum falcatum*.
77
  **Symptoms:**
78
  - Red streaks inside the cane with white patches.
79
  - Rotting of the stalk, emitting a sour smell.
 
82
  **Management:**
83
  - Plant resistant varieties.
84
  - Remove and burn infected plants.
85
+ - Treat soil with fungicides and practice crop rotation.,
86
 
87
+ 'Rust': Rust is caused by the fungus *Puccinia melanocephala*.
88
  **Symptoms:**
89
  - Formation of orange to reddish pustules on leaves.
90
  - Premature drying of leaves.
 
93
  **Management:**
94
  - Apply systemic fungicides (e.g., triazoles).
95
  - Ensure proper field hygiene.
96
+ - Avoid water stress and maintain balanced nutrition.,
97
 
98
+ 'Yellow': Yellowing can be caused by nutrient deficiencies or disease onset.
99
  **Symptoms:**
100
  - Yellowing of leaf tips or entire leaves.
101
  - Reduced photosynthesis and growth.
 
103
  **Management:**
104
  - Conduct soil testing to identify deficiencies.
105
  - Apply balanced fertilizers as per soil nutrient status.
106
+ - Maintain proper irrigation schedules.,
107
 
108
+ 'Smut': Smut is caused by the fungus *Sporisorium scitamineum*.
109
  **Symptoms:**
110
  - Formation of whip-like structures at the growing points.
111
  - Stunted growth and tiller proliferation.
 
114
  **Management:**
115
  - Plant smut-resistant varieties.
116
  - Remove smut-infected plants.
117
+ - Treat seed sets with fungicides before planting.,
118
 
119
+ 'Healthy': The sugarcane crop is healthy.
120
  Continue regular monitoring and follow good agronomic practices:
121
  - Ensure balanced fertilization.
122
  - Maintain proper irrigation schedules.
123
+ - Monitor for pests and diseases regularly.,
124
+
125
+ 'GeneralPractices': **General Practices for Disease Prevention**
126
  - **Field Sanitation:** Remove and destroy crop residues and infected plants to reduce inoculum levels.
127
  - **Resistant Varieties:** Cultivate sugarcane varieties that are resistant to specific diseases.
128
  - **Seed Treatment:** Use disease-free, certified seed material. Treat seed sets with fungicides before planting.
129
  - **Crop Rotation:** Rotate sugarcane with non-host crops to break the disease cycle.
130
  - **Optimal Agronomic Practices:** Ensure proper irrigation and drainage. Maintain balanced fertilization and avoid over-application of nitrogen.
131
  - **Timely Monitoring and Control:** Inspect fields regularly for symptoms. Apply recommended fungicides or bactericides as soon as symptoms appear.
132
+ - **Integrated Pest and Disease Management (IPDM):** Combine biological, chemical, and cultural methods to manage diseases sustainably.,
133
+
134
+ 'ImpactOfDiseases': **Impact of Sugarcane Diseases**
135
  - **Yield Reduction:** Diseases like red rot and smut can reduce cane yield by 30–60%.
136
  - **Quality Degradation:** Affected plants produce less sugar and lower-quality juice.
137
+ - **Economic Losses:** Increased cost of management and reduced marketable output affect profitability.,
138
+
139
+ 'SugarcaneOverview': Sugarcane is a critical crop globally, providing raw materials for sugar, ethanol, and other byproducts.
140
  However, it is susceptible to various diseases caused by fungi, bacteria, viruses, and environmental factors.
141
+ Effective management practices are essential to ensure high yield and quality.
142
+ """
143
+
144
 
145
 
146
  # Update the predict_disease function