hari7261 commited on
Commit
2edc2b5
·
verified ·
1 Parent(s): b1883a0

Upload 3 files

Browse files
Files changed (3) hide show
  1. README_HF.md +56 -0
  2. agricultural_data.json +325 -0
  3. requirements_gradio.txt +8 -0
README_HF.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: AgriBot - AI Agricultural Assistant
3
+ emoji: 🌾
4
+ colorFrom: green
5
+ colorTo: emerald
6
+ sdk: gradio
7
+ sdk_version: 4.44.0
8
+ app_file: app.py
9
+ pinned: false
10
+ license: mit
11
+ ---
12
+
13
+ # 🌾 AgriBot - AI Agricultural Assistant
14
+
15
+ An intelligent agricultural chatbot powered by AI that provides expert farming guidance, crop cultivation advice, pest management strategies, and comprehensive agricultural knowledge.
16
+
17
+ ## Features
18
+
19
+ - 🧠 **AI-Powered Intelligence**: Advanced AI models for conversational agricultural advice
20
+ - 🌱 **Comprehensive Database**: Extensive knowledge base covering crops, diseases, pests, and fertilizers
21
+ - 💡 **Professional Guidance**: Practical advice from cultivation to harvest
22
+ - 🛡️ **Integrated Pest Management**: Sustainable pest and disease control strategies
23
+ - 🌾 **Multi-Crop Support**: Rice, Wheat, Corn, Tomato, Potato, and more
24
+
25
+ ## How to Use
26
+
27
+ 1. Type your agricultural question in the chat box
28
+ 2. Get expert AI-generated advice based on comprehensive agricultural data
29
+ 3. Ask about specific crops, diseases, pests, fertilizers, or farming techniques
30
+ 4. Follow the practical recommendations for better farming outcomes
31
+
32
+ ## Example Questions
33
+
34
+ - "How to grow wheat in clay soil?"
35
+ - "Best fertilizer for rice cultivation?"
36
+ - "Organic pest control methods for tomatoes?"
37
+ - "Disease management in potato crops?"
38
+ - "Soil preparation techniques?"
39
+
40
+ ## Technology Stack
41
+
42
+ - **AI Model**: Microsoft DialoGPT for conversational responses
43
+ - **Semantic Search**: Sentence Transformers for knowledge retrieval
44
+ - **Frontend**: Gradio with custom CSS styling
45
+ - **Backend**: Python with comprehensive agricultural database
46
+
47
+ ## Deploy Your Own
48
+
49
+ 1. Clone this repository
50
+ 2. Install requirements: `pip install -r requirements.txt`
51
+ 3. Run locally: `python app.py`
52
+ 4. Deploy on Hugging Face Spaces
53
+
54
+ ---
55
+
56
+ *Helping farmers grow smarter with AI technology* 🚀
agricultural_data.json ADDED
@@ -0,0 +1,325 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "crops": {
3
+ "rice": {
4
+ "scientific_name": "Oryza sativa",
5
+ "family": "Poaceae",
6
+ "season": "Kharif (June-November)",
7
+ "climate": "Warm and humid climate with temperature 20-35°C",
8
+ "soil": {
9
+ "type": "Clay or loamy soil with good water retention",
10
+ "ph": "5.5-7.0",
11
+ "drainage": "Poor drainage preferred, flooded conditions"
12
+ },
13
+ "water_requirement": "1500-2000mm annually, flooded fields",
14
+ "fertilizer": {
15
+ "npk": "120:60:40 kg/ha",
16
+ "organic": "10-15 tonnes FYM per hectare",
17
+ "micronutrients": "Zinc, Iron"
18
+ },
19
+ "planting": {
20
+ "method": "Transplanting or direct seeding",
21
+ "spacing": "20cm x 15cm",
22
+ "depth": "2-3cm",
23
+ "seed_rate": "25-30kg/ha"
24
+ },
25
+ "diseases": [
26
+ {"name": "Blast", "cause": "Pyricularia oryzae", "symptoms": "Leaf spots, neck blast", "control": "Tricyclazole spray"},
27
+ {"name": "Brown spot", "cause": "Helminthosporium oryzae", "symptoms": "Brown spots on leaves", "control": "Mancozeb application"},
28
+ {"name": "Bacterial blight", "cause": "Xanthomonas oryzae", "symptoms": "Water-soaked lesions", "control": "Copper oxychloride"}
29
+ ],
30
+ "pests": [
31
+ {"name": "Stem borer", "scientific": "Scirpophaga incertulas", "damage": "Dead hearts, white ears", "control": "Pheromone traps, Bt spray"},
32
+ {"name": "Brown planthopper", "scientific": "Nilaparvata lugens", "damage": "Yellowing, hopper burn", "control": "Imidacloprid seed treatment"},
33
+ {"name": "Leaf folder", "scientific": "Cnaphalocrocis medinalis", "damage": "Folded leaves", "control": "Chlorpyrifos spray"}
34
+ ],
35
+ "harvesting": {
36
+ "time": "110-140 days after planting",
37
+ "indicators": "Golden yellow grains, 80% maturity",
38
+ "method": "Manual or mechanical harvesting"
39
+ },
40
+ "yield": "4-6 tonnes per hectare",
41
+ "storage": "Dry to 14% moisture, store in cool dry place",
42
+ "nutritional_value": {
43
+ "carbohydrates": "78g per 100g",
44
+ "protein": "7g per 100g",
45
+ "calories": "365 per 100g"
46
+ },
47
+ "market_uses": ["Staple food", "Rice flour", "Rice bran oil", "Animal feed", "Rice wine"]
48
+ },
49
+ "wheat": {
50
+ "scientific_name": "Triticum aestivum",
51
+ "family": "Poaceae",
52
+ "season": "Rabi (November-April)",
53
+ "climate": "Cool and dry climate, temperature 15-25°C",
54
+ "soil": {
55
+ "type": "Well-drained loamy soil",
56
+ "ph": "6.0-7.5",
57
+ "drainage": "Good drainage essential"
58
+ },
59
+ "water_requirement": "450-650mm during growing season",
60
+ "fertilizer": {
61
+ "npk": "120:60:40 kg/ha",
62
+ "organic": "8-10 tonnes FYM per hectare",
63
+ "micronutrients": "Zinc, Boron"
64
+ },
65
+ "planting": {
66
+ "method": "Broadcasting or line sowing",
67
+ "spacing": "22.5cm between rows",
68
+ "depth": "3-5cm",
69
+ "seed_rate": "100-125kg/ha"
70
+ },
71
+ "diseases": [
72
+ {"name": "Rust", "cause": "Puccinia species", "symptoms": "Orange pustules on leaves", "control": "Propiconazole spray"},
73
+ {"name": "Smut", "cause": "Ustilago tritici", "symptoms": "Black powdery spores", "control": "Seed treatment with vitavax"},
74
+ {"name": "Bunt", "cause": "Tilletia species", "symptoms": "Fishy smell, black spores", "control": "Seed treatment"}
75
+ ],
76
+ "pests": [
77
+ {"name": "Aphids", "scientific": "Rhopalosiphum species", "damage": "Yellowing, stunted growth", "control": "Imidacloprid spray"},
78
+ {"name": "Termites", "scientific": "Odontotermes species", "damage": "Root damage, plant death", "control": "Chlorpyrifos soil treatment"},
79
+ {"name": "Cutworms", "scientific": "Agrotis species", "damage": "Cut seedlings at soil level", "control": "Quinalphos dust"}
80
+ ],
81
+ "harvesting": {
82
+ "time": "110-130 days after sowing",
83
+ "indicators": "Golden yellow color, hard grains",
84
+ "method": "Combine harvester or manual"
85
+ },
86
+ "yield": "3-5 tonnes per hectare",
87
+ "storage": "Dry to 12% moisture, store in bins",
88
+ "nutritional_value": {
89
+ "carbohydrates": "71g per 100g",
90
+ "protein": "12g per 100g",
91
+ "calories": "339 per 100g"
92
+ },
93
+ "market_uses": ["Flour production", "Bread making", "Pasta", "Animal feed", "Straw for construction"]
94
+ },
95
+ "corn": {
96
+ "scientific_name": "Zea mays",
97
+ "family": "Poaceae",
98
+ "season": "Kharif (June-September)",
99
+ "climate": "Warm climate, temperature 21-27°C",
100
+ "soil": {
101
+ "type": "Well-drained fertile soil",
102
+ "ph": "5.8-7.0",
103
+ "drainage": "Good drainage required"
104
+ },
105
+ "water_requirement": "500-800mm during growing season",
106
+ "fertilizer": {
107
+ "npk": "150:75:75 kg/ha",
108
+ "organic": "12-15 tonnes FYM per hectare",
109
+ "micronutrients": "Zinc, Manganese"
110
+ },
111
+ "planting": {
112
+ "method": "Line sowing",
113
+ "spacing": "60cm x 20cm",
114
+ "depth": "3-4cm",
115
+ "seed_rate": "18-25kg/ha"
116
+ },
117
+ "diseases": [
118
+ {"name": "Leaf blight", "cause": "Helminthosporium species", "symptoms": "Brown lesions on leaves", "control": "Mancozeb spray"},
119
+ {"name": "Stalk rot", "cause": "Fusarium species", "symptoms": "Rotting of stem", "control": "Crop rotation, resistant varieties"},
120
+ {"name": "Ear rot", "cause": "Fusarium species", "symptoms": "Moldy ears", "control": "Proper drying, storage"}
121
+ ],
122
+ "pests": [
123
+ {"name": "Corn borer", "scientific": "Ostrinia nubilalis", "damage": "Holes in stem, broken stalks", "control": "Bt corn, pheromone traps"},
124
+ {"name": "Fall armyworm", "scientific": "Spodoptera frugiperda", "damage": "Feeding on leaves and ears", "control": "Spinosad spray, Bt application"},
125
+ {"name": "Cutworms", "scientific": "Agrotis species", "damage": "Cut seedlings", "control": "Collar barriers, beneficial nematodes"}
126
+ ],
127
+ "harvesting": {
128
+ "time": "90-120 days after planting",
129
+ "indicators": "Brown silks, hard kernels",
130
+ "method": "Hand picking or mechanical harvester"
131
+ },
132
+ "yield": "5-8 tonnes per hectare",
133
+ "storage": "Dry to 14% moisture, store in ventilated bins",
134
+ "nutritional_value": {
135
+ "carbohydrates": "74g per 100g",
136
+ "protein": "9g per 100g",
137
+ "calories": "365 per 100g"
138
+ },
139
+ "market_uses": ["Fresh consumption", "Animal feed", "Corn flour", "Corn oil", "Biofuel", "High fructose corn syrup"]
140
+ },
141
+ "tomato": {
142
+ "scientific_name": "Solanum lycopersicum",
143
+ "family": "Solanaceae",
144
+ "season": "Year-round with proper care",
145
+ "climate": "Warm climate, temperature 20-30°C",
146
+ "soil": {
147
+ "type": "Well-drained sandy loam soil",
148
+ "ph": "6.0-6.8",
149
+ "drainage": "Good drainage essential"
150
+ },
151
+ "water_requirement": "400-600mm, regular watering needed",
152
+ "fertilizer": {
153
+ "npk": "100:50:50 kg/ha",
154
+ "organic": "20-25 tonnes FYM per hectare",
155
+ "micronutrients": "Calcium, Magnesium, Boron"
156
+ },
157
+ "planting": {
158
+ "method": "Transplanting seedlings",
159
+ "spacing": "60cm x 45cm",
160
+ "depth": "1cm for seeds",
161
+ "seed_rate": "200-250g/ha"
162
+ },
163
+ "diseases": [
164
+ {"name": "Late blight", "cause": "Phytophthora infestans", "symptoms": "Brown patches on leaves", "control": "Metalaxyl + Mancozeb"},
165
+ {"name": "Early blight", "cause": "Alternaria solani", "symptoms": "Concentric rings on leaves", "control": "Chlorothalonil spray"},
166
+ {"name": "Bacterial wilt", "cause": "Ralstonia solanacearum", "symptoms": "Wilting, yellowing", "control": "Resistant varieties, soil solarization"}
167
+ ],
168
+ "pests": [
169
+ {"name": "Whitefly", "scientific": "Bemisia tabaci", "damage": "Yellowing, virus transmission", "control": "Yellow sticky traps, neem oil"},
170
+ {"name": "Aphids", "scientific": "Aphis gossypii", "damage": "Curling leaves, honeydew", "control": "Ladybugs, insecticidal soap"},
171
+ {"name": "Fruit borer", "scientific": "Helicoverpa armigera", "damage": "Holes in fruits", "control": "Bt spray, NPV application"}
172
+ ],
173
+ "harvesting": {
174
+ "time": "70-90 days after transplanting",
175
+ "indicators": "Color change, slight softness",
176
+ "method": "Hand picking when mature"
177
+ },
178
+ "yield": "25-40 tonnes per hectare",
179
+ "storage": "Cool storage at 12-15°C, 85-90% humidity",
180
+ "nutritional_value": {
181
+ "carbohydrates": "4g per 100g",
182
+ "protein": "1g per 100g",
183
+ "calories": "18 per 100g",
184
+ "vitamin_c": "23mg per 100g"
185
+ },
186
+ "market_uses": ["Fresh consumption", "Tomato sauce", "Paste", "Juice", "Soup", "Canning", "Ketchup"]
187
+ },
188
+ "potato": {
189
+ "scientific_name": "Solanum tuberosum",
190
+ "family": "Solanaceae",
191
+ "season": "Rabi (October-February)",
192
+ "climate": "Cool climate, temperature 15-25°C",
193
+ "soil": {
194
+ "type": "Well-drained sandy loam soil",
195
+ "ph": "5.0-6.5",
196
+ "drainage": "Excellent drainage required"
197
+ },
198
+ "water_requirement": "400-500mm during growing season",
199
+ "fertilizer": {
200
+ "npk": "180:80:100 kg/ha",
201
+ "organic": "25-30 tonnes FYM per hectare",
202
+ "micronutrients": "Potassium, Magnesium"
203
+ },
204
+ "planting": {
205
+ "method": "Planting tubers",
206
+ "spacing": "60cm x 20cm",
207
+ "depth": "5-7cm",
208
+ "seed_rate": "2-2.5 tonnes/ha"
209
+ },
210
+ "diseases": [
211
+ {"name": "Late blight", "cause": "Phytophthora infestans", "symptoms": "Brown patches, tuber rot", "control": "Ridomil Gold spray"},
212
+ {"name": "Early blight", "cause": "Alternaria solani", "symptoms": "Dark spots with rings", "control": "Mancozeb application"},
213
+ {"name": "Black scurf", "cause": "Rhizoctonia solani", "symptoms": "Black sclerotia on tubers", "control": "Seed treatment, crop rotation"}
214
+ ],
215
+ "pests": [
216
+ {"name": "Colorado beetle", "scientific": "Leptinotarsa decemlineata", "damage": "Defoliation", "control": "Spinosad spray, hand picking"},
217
+ {"name": "Aphids", "scientific": "Myzus persicae", "damage": "Virus transmission", "control": "Reflective mulch, predatory insects"},
218
+ {"name": "Cutworms", "scientific": "Agrotis species", "damage": "Cut plants at soil level", "control": "Soil treatment, collar protection"}
219
+ ],
220
+ "harvesting": {
221
+ "time": "90-120 days after planting",
222
+ "indicators": "Yellowing of foliage",
223
+ "method": "Mechanical or manual digging"
224
+ },
225
+ "yield": "20-35 tonnes per hectare",
226
+ "storage": "Dark, cool (2-4°C), well-ventilated storage",
227
+ "nutritional_value": {
228
+ "carbohydrates": "17g per 100g",
229
+ "protein": "2g per 100g",
230
+ "calories": "77 per 100g",
231
+ "vitamin_c": "20mg per 100g"
232
+ },
233
+ "market_uses": ["Fresh consumption", "French fries", "Chips", "Starch production", "Alcohol production", "Animal feed"]
234
+ }
235
+ },
236
+ "farming_techniques": {
237
+ "organic_farming": {
238
+ "definition": "Farming without synthetic chemicals",
239
+ "principles": ["Soil health", "Biodiversity", "Natural pest control", "Crop rotation"],
240
+ "benefits": ["Environmental safety", "Better soil health", "Higher prices", "Sustainable"],
241
+ "challenges": ["Lower initial yields", "Certification costs", "Labor intensive"],
242
+ "practices": [
243
+ "Composting", "Green manuring", "Biological pest control", "Crop diversification"
244
+ ]
245
+ },
246
+ "precision_agriculture": {
247
+ "definition": "Technology-driven farming approach",
248
+ "technologies": ["GPS", "Sensors", "Drones", "Satellite imagery", "Variable rate application"],
249
+ "benefits": ["Increased efficiency", "Reduced input costs", "Better yields", "Environmental protection"],
250
+ "applications": ["Soil mapping", "Yield monitoring", "Pest detection", "Irrigation management"]
251
+ },
252
+ "crop_rotation": {
253
+ "definition": "Growing different crops in succession",
254
+ "benefits": ["Soil fertility", "Pest control", "Disease prevention", "Yield improvement"],
255
+ "common_rotations": [
256
+ "Rice-Wheat", "Corn-Soybean", "Potato-Cabbage", "Tomato-Onion"
257
+ ],
258
+ "principles": ["Different nutrient requirements", "Breaking pest cycles", "Nitrogen fixation"]
259
+ }
260
+ },
261
+ "soil_management": {
262
+ "soil_types": {
263
+ "clay": {
264
+ "characteristics": "Heavy, poor drainage, high water retention",
265
+ "suitable_crops": ["Rice", "Sugarcane", "Cotton"],
266
+ "management": ["Add organic matter", "Improve drainage", "Avoid compaction"]
267
+ },
268
+ "sandy": {
269
+ "characteristics": "Light, good drainage, low water retention",
270
+ "suitable_crops": ["Groundnut", "Watermelon", "Carrots"],
271
+ "management": ["Add organic matter", "Frequent irrigation", "Mulching"]
272
+ },
273
+ "loamy": {
274
+ "characteristics": "Balanced texture, good drainage and retention",
275
+ "suitable_crops": ["Most crops", "Wheat", "Corn", "Vegetables"],
276
+ "management": ["Maintain organic matter", "Regular testing", "Crop rotation"]
277
+ }
278
+ },
279
+ "ph_management": {
280
+ "acidic_soils": {
281
+ "ph_range": "Below 6.0",
282
+ "problems": ["Aluminum toxicity", "Poor nutrient availability"],
283
+ "correction": ["Lime application", "Organic matter addition"],
284
+ "suitable_crops": ["Blueberries", "Azaleas", "Potatoes"]
285
+ },
286
+ "alkaline_soils": {
287
+ "ph_range": "Above 8.0",
288
+ "problems": ["Iron deficiency", "Poor phosphorus availability"],
289
+ "correction": ["Sulfur application", "Organic matter", "Gypsum"],
290
+ "suitable_crops": ["Asparagus", "Spinach", "Beets"]
291
+ }
292
+ }
293
+ },
294
+ "pest_management": {
295
+ "integrated_pest_management": {
296
+ "definition": "Holistic approach to pest control",
297
+ "components": ["Prevention", "Monitoring", "Biological control", "Chemical control"],
298
+ "benefits": ["Reduced pesticide use", "Cost effective", "Environmental safety", "Sustainable"]
299
+ },
300
+ "biological_control": {
301
+ "predators": [
302
+ {"name": "Ladybugs", "target": "Aphids, scales", "usage": "Release in infested areas"},
303
+ {"name": "Parasitic wasps", "target": "Caterpillars, aphids", "usage": "Natural occurrence, habitat provision"},
304
+ {"name": "Predatory mites", "target": "Spider mites, thrips", "usage": "Release on affected plants"}
305
+ ],
306
+ "pathogens": [
307
+ {"name": "Bt (Bacillus thuringiensis)", "target": "Caterpillars", "usage": "Spray application"},
308
+ {"name": "NPV (Nuclear Polyhedrosis Virus)", "target": "Bollworm", "usage": "Spray during evening"},
309
+ {"name": "Trichoderma", "target": "Soil-borne diseases", "usage": "Soil application"}
310
+ ]
311
+ }
312
+ },
313
+ "weather_farming": {
314
+ "monsoon_farming": {
315
+ "crops": ["Rice", "Cotton", "Sugarcane", "Pulses"],
316
+ "practices": ["Water harvesting", "Drainage management", "Disease monitoring"],
317
+ "challenges": ["Flooding", "Pest outbreaks", "Nutrient leaching"]
318
+ },
319
+ "drought_management": {
320
+ "strategies": ["Drought-resistant varieties", "Mulching", "Drip irrigation", "Rainwater harvesting"],
321
+ "crops": ["Millets", "Sorghum", "Chickpea", "Sunflower"],
322
+ "practices": ["Deep plowing", "Organic matter addition", "Crop insurance"]
323
+ }
324
+ }
325
+ }
requirements_gradio.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ gradio>=4.0.0
2
+ transformers>=4.30.0
3
+ torch>=2.0.0
4
+ accelerate>=0.20.0
5
+ sentencepiece>=0.1.99
6
+ protobuf>=3.20.0
7
+ sentence-transformers>=2.2.0
8
+ numpy>=1.21.0