NitinBot001 commited on
Commit
6a9a0ba
·
verified ·
1 Parent(s): adeabd4

Upload 8 files

Browse files
Files changed (8) hide show
  1. Dockerfile +31 -0
  2. app.py +601 -0
  3. data/maize_data.txt +822 -0
  4. maize_data.txt +822 -0
  5. requirements.txt +12 -0
  6. static/index.html +83 -0
  7. static/script.js +261 -0
  8. static/style.css +0 -0
Dockerfile ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install system dependencies
6
+ RUN apt-get update && apt-get install -y \
7
+ gcc \
8
+ g++ \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ # Copy requirements and install Python dependencies
12
+ COPY requirements.txt .
13
+ RUN pip install --no-cache-dir -r requirements.txt
14
+
15
+ # Create necessary directories
16
+ RUN mkdir -p static data
17
+
18
+ # Copy application files
19
+ COPY app.py .
20
+ COPY static/ static/
21
+ COPY data/ data/
22
+
23
+ # Create a non-root user
24
+ RUN useradd -m -u 1000 user && chown -R user:user /app
25
+ USER user
26
+
27
+ # Expose port for Hugging Face Spaces
28
+ EXPOSE 7860
29
+
30
+ # Run the application
31
+ CMD ["python", "app.py"]
app.py ADDED
@@ -0,0 +1,601 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import time
3
+ import gradio as gr
4
+ import uvicorn
5
+ from fastapi import FastAPI, HTTPException, Depends, File, UploadFile
6
+ from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
7
+ from pydantic import BaseModel
8
+ from typing import Optional, Dict, Any
9
+ import threading
10
+ import logging
11
+ from langchain.document_loaders import TextLoader
12
+ from langchain.text_splitter import RecursiveCharacterTextSplitter
13
+ from langchain.vectorstores import FAISS
14
+ from langchain.chains import RetrievalQA
15
+ from langchain.prompts import PromptTemplate
16
+ from langchain.callbacks.base import BaseCallbackHandler
17
+ from langchain_google_genai import ChatGoogleGenerativeAI, GoogleGenerativeAIEmbeddings
18
+ import tiktoken
19
+
20
+ # Configure logging
21
+ logging.basicConfig(level=logging.INFO)
22
+ logger = logging.getLogger(__name__)
23
+
24
+ # --- Configuration ---
25
+ CHUNK_SIZE = 800
26
+ CHUNK_OVERLAP = 100
27
+ MAX_TOKENS = 512
28
+ TEMPERATURE = 0.5
29
+ RETRIEVAL_K = 5
30
+
31
+ # --- Token Counting Setup ---
32
+ try:
33
+ tokenizer = tiktoken.get_encoding("cl100k_base")
34
+ except:
35
+ print("Tiktoken encoder 'cl100k_base' not found. Using basic split().")
36
+ tokenizer = type('obj', (object,), {'encode': lambda x: x.split()})()
37
+
38
+ def estimate_tokens(text):
39
+ """Estimates token count for a given text."""
40
+ return len(tokenizer.encode(text))
41
+
42
+ # Custom Callback Handler to track LLM token usage
43
+ class TokenUsageCallbackHandler(BaseCallbackHandler):
44
+ """Callback handler to track token usage in LLM calls."""
45
+ def __init__(self):
46
+ super().__init__()
47
+ self.reset_counters()
48
+
49
+ def reset_counters(self):
50
+ self.total_prompt_tokens = 0
51
+ self.total_completion_tokens = 0
52
+ self.total_llm_calls = 0
53
+
54
+ def on_llm_end(self, response, **kwargs):
55
+ """Collect token usage from the LLM response."""
56
+ self.total_llm_calls += 1
57
+ llm_output = response.llm_output
58
+
59
+ if llm_output and 'usage_metadata' in llm_output:
60
+ usage = llm_output['usage_metadata']
61
+ prompt_tokens = usage.get('prompt_token_count', 0)
62
+ completion_tokens = usage.get('candidates_token_count', 0)
63
+
64
+ self.total_prompt_tokens += prompt_tokens
65
+ self.total_completion_tokens += completion_tokens
66
+
67
+ def get_total_tokens(self):
68
+ """Returns the total prompt and completion tokens."""
69
+ return {
70
+ "total_prompt_tokens": self.total_prompt_tokens,
71
+ "total_completion_tokens": self.total_completion_tokens,
72
+ "total_llm_tokens": self.total_prompt_tokens + self.total_completion_tokens,
73
+ "total_llm_calls": self.total_llm_calls
74
+ }
75
+
76
+ # --- Pydantic Models for API ---
77
+ class InitializeRequest(BaseModel):
78
+ api_key: str
79
+ document_content: Optional[str] = None
80
+
81
+ class QueryRequest(BaseModel):
82
+ query: str
83
+ api_key: str
84
+
85
+ class InitializeResponse(BaseModel):
86
+ success: bool
87
+ message: str
88
+ chunks: Optional[int] = None
89
+ estimated_tokens: Optional[int] = None
90
+
91
+ class QueryResponse(BaseModel):
92
+ success: bool
93
+ answer: str
94
+ response_time: float
95
+ query_tokens: int
96
+ llm_tokens: Dict[str, int]
97
+ session_stats: Dict[str, int]
98
+
99
+ class StatsResponse(BaseModel):
100
+ total_queries: int
101
+ total_embedding_tokens: int
102
+ total_llm_tokens: int
103
+ total_llm_calls: int
104
+ initialization_complete: bool
105
+
106
+ # --- Global Variables ---
107
+ class RAGSystem:
108
+ def __init__(self):
109
+ self.vector_store = None
110
+ self.qa_chain = None
111
+ self.token_callback_handler = TokenUsageCallbackHandler()
112
+ self.session_stats = {
113
+ "total_queries": 0,
114
+ "total_embedding_tokens": 0,
115
+ "initialization_complete": False
116
+ }
117
+ self.current_api_key = None
118
+
119
+ # Global RAG system instance
120
+ rag_system = RAGSystem()
121
+
122
+ def initialize_rag_system(api_key, file_content=None):
123
+ """Initialize the RAG system with API key and optional file content."""
124
+ global rag_system
125
+
126
+ try:
127
+ # Set API key
128
+ os.environ["GOOGLE_API_KEY"] = api_key
129
+ rag_system.current_api_key = api_key
130
+
131
+ # Initialize embeddings
132
+ embeddings = GoogleGenerativeAIEmbeddings(
133
+ model="models/embedding-001",
134
+ google_api_key=api_key
135
+ )
136
+
137
+ # Initialize LLM
138
+ llm = ChatGoogleGenerativeAI(
139
+ model="gemini-1.5-flash",
140
+ google_api_key=api_key,
141
+ temperature=TEMPERATURE,
142
+ max_tokens=MAX_TOKENS,
143
+ callbacks=[rag_system.token_callback_handler],
144
+ verbose=False
145
+ )
146
+
147
+ # Load or use default document
148
+ if file_content:
149
+ # Save uploaded file content
150
+ with open("uploaded_document.txt", "w", encoding="utf-8") as f:
151
+ f.write(file_content)
152
+ loader = TextLoader("uploaded_document.txt")
153
+ else:
154
+ # Check if default maize_data.txt exists
155
+ if os.path.exists("maize_data.txt"):
156
+ loader = TextLoader("maize_data.txt")
157
+ else:
158
+ return "❌ No document found. Please upload a file or ensure maize_data.txt exists."
159
+
160
+ # Load and split documents
161
+ documents = loader.load()
162
+ text_splitter = RecursiveCharacterTextSplitter(
163
+ chunk_size=CHUNK_SIZE,
164
+ chunk_overlap=CHUNK_OVERLAP
165
+ )
166
+ chunks = text_splitter.split_documents(documents)
167
+
168
+ # Estimate embedding tokens
169
+ initial_embedding_tokens = sum(estimate_tokens(chunk.page_content) for chunk in chunks)
170
+ rag_system.session_stats["total_embedding_tokens"] = initial_embedding_tokens
171
+
172
+ # Create vector store
173
+ rag_system.vector_store = FAISS.from_documents(chunks, embeddings)
174
+
175
+ # Create prompt template
176
+ prompt_template = PromptTemplate(
177
+ input_variables=["context", "question"],
178
+ template="""
179
+ You are an expert in maize agriculture. Use the following context ONLY to answer the question accurately and helpfully. If the context doesn't contain the answer, say "Based on the provided context, I cannot answer this question.".
180
+
181
+ Context:
182
+ {context}
183
+
184
+ Question: {question}
185
+
186
+ Answer:"""
187
+ )
188
+
189
+ # Set up QA chain
190
+ rag_system.qa_chain = RetrievalQA.from_chain_type(
191
+ llm=llm,
192
+ chain_type="stuff",
193
+ retriever=rag_system.vector_store.as_retriever(search_kwargs={"k": RETRIEVAL_K}),
194
+ chain_type_kwargs={"prompt": prompt_template},
195
+ callbacks=[rag_system.token_callback_handler],
196
+ return_source_documents=True
197
+ )
198
+
199
+ rag_system.session_stats["initialization_complete"] = True
200
+
201
+ return f"✅ RAG system initialized successfully!\n📄 Document processed: {len(chunks)} chunks\n🔢 Estimated embedding tokens: ~{initial_embedding_tokens}"
202
+
203
+ except Exception as e:
204
+ logger.error(f"Initialization failed: {str(e)}")
205
+ return f"❌ Initialization failed: {str(e)}"
206
+
207
+ def process_query(query, api_key):
208
+ """Process a user query through the RAG system."""
209
+ global rag_system
210
+
211
+ if not api_key:
212
+ return "❌ Please provide a Google API key first.", ""
213
+
214
+ if not rag_system.qa_chain:
215
+ return "❌ RAG system not initialized. Please initialize first.", ""
216
+
217
+ if not query.strip():
218
+ return "❌ Please enter a question.", ""
219
+
220
+ try:
221
+ # Estimate query embedding tokens
222
+ query_tokens = estimate_tokens(query)
223
+ rag_system.session_stats["total_embedding_tokens"] += query_tokens
224
+ rag_system.session_stats["total_queries"] += 1
225
+
226
+ # Process query
227
+ start_time = time.time()
228
+ result = rag_system.qa_chain({"query": query})
229
+ end_time = time.time()
230
+
231
+ # Get token usage
232
+ llm_tokens = rag_system.token_callback_handler.get_total_tokens()
233
+
234
+ # Format response
235
+ answer = result['result']
236
+
237
+ # Create stats summary
238
+ stats = f"""
239
+ 📊 **Query Statistics:**
240
+ - Response time: {end_time - start_time:.2f} seconds
241
+ - Query tokens (estimated): ~{query_tokens}
242
+ - LLM tokens (this query): Prompt: {llm_tokens['total_prompt_tokens']}, Completion: {llm_tokens['total_completion_tokens']}
243
+
244
+ 📈 **Session Statistics:**
245
+ - Total queries: {rag_system.session_stats['total_queries']}
246
+ - Total embedding tokens: ~{rag_system.session_stats['total_embedding_tokens']}
247
+ - Total LLM calls: {llm_tokens['total_llm_calls']}
248
+ - Total LLM tokens: {llm_tokens['total_llm_tokens']}
249
+ """
250
+
251
+ return answer, stats
252
+
253
+ except Exception as e:
254
+ logger.error(f"Error processing query: {str(e)}")
255
+ return f"❌ Error processing query: {str(e)}", ""
256
+
257
+ def upload_file_and_initialize(api_key, file):
258
+ """Handle file upload and system initialization."""
259
+ if not api_key:
260
+ return "❌ Please provide a Google API key first."
261
+
262
+ if file is None:
263
+ return initialize_rag_system(api_key)
264
+
265
+ try:
266
+ # Read uploaded file
267
+ file_content = file.decode('utf-8')
268
+ return initialize_rag_system(api_key, file_content)
269
+ except Exception as e:
270
+ return f"❌ Error reading uploaded file: {str(e)}"
271
+
272
+ def reset_session():
273
+ """Reset the session statistics."""
274
+ global rag_system
275
+ rag_system.token_callback_handler.reset_counters()
276
+ rag_system.session_stats = {
277
+ "total_queries": 0,
278
+ "total_embedding_tokens": 0,
279
+ "initialization_complete": False
280
+ }
281
+ return "🔄 Session statistics reset."
282
+
283
+ # --- FastAPI Setup ---
284
+ app = FastAPI(
285
+ title="Maize RAG Q&A System API",
286
+ description="API for the Maize Agriculture RAG Q&A System",
287
+ version="1.0.0"
288
+ )
289
+
290
+ # Optional: Add API key authentication for API endpoints
291
+ security = HTTPBearer(auto_error=False)
292
+
293
+ async def get_api_key(credentials: HTTPAuthorizationCredentials = Depends(security)):
294
+ """Extract API key from Authorization header (optional)"""
295
+ if credentials:
296
+ return credentials.credentials
297
+ return None
298
+
299
+ # --- API Endpoints ---
300
+
301
+ @app.get("/")
302
+ async def root():
303
+ """Root endpoint"""
304
+ return {"message": "Maize RAG Q&A System API", "status": "running"}
305
+
306
+ @app.get("/health")
307
+ async def health_check():
308
+ """Health check endpoint"""
309
+ return {
310
+ "status": "healthy",
311
+ "system_initialized": rag_system.session_stats["initialization_complete"]
312
+ }
313
+
314
+ @app.post("/initialize", response_model=InitializeResponse)
315
+ async def initialize_system(request: InitializeRequest):
316
+ """Initialize the RAG system"""
317
+ try:
318
+ result = initialize_rag_system(request.api_key, request.document_content)
319
+
320
+ if "✅" in result:
321
+ # Parse successful result
322
+ lines = result.split('\n')
323
+ chunks = None
324
+ tokens = None
325
+
326
+ for line in lines:
327
+ if "chunks" in line:
328
+ chunks = int(line.split(': ')[1].split(' ')[0])
329
+ elif "tokens" in line:
330
+ tokens = int(line.split('~')[1])
331
+
332
+ return InitializeResponse(
333
+ success=True,
334
+ message=result,
335
+ chunks=chunks,
336
+ estimated_tokens=tokens
337
+ )
338
+ else:
339
+ return InitializeResponse(
340
+ success=False,
341
+ message=result
342
+ )
343
+
344
+ except Exception as e:
345
+ logger.error(f"API initialization error: {str(e)}")
346
+ raise HTTPException(status_code=500, detail=str(e))
347
+
348
+ @app.post("/query", response_model=QueryResponse)
349
+ async def query_system(request: QueryRequest):
350
+ """Query the RAG system"""
351
+ try:
352
+ if not rag_system.session_stats["initialization_complete"]:
353
+ raise HTTPException(status_code=400, detail="System not initialized")
354
+
355
+ # Estimate query embedding tokens
356
+ query_tokens = estimate_tokens(request.query)
357
+ rag_system.session_stats["total_embedding_tokens"] += query_tokens
358
+ rag_system.session_stats["total_queries"] += 1
359
+
360
+ # Process query
361
+ start_time = time.time()
362
+ result = rag_system.qa_chain({"query": request.query})
363
+ end_time = time.time()
364
+
365
+ # Get token usage
366
+ llm_tokens = rag_system.token_callback_handler.get_total_tokens()
367
+
368
+ response_time = end_time - start_time
369
+
370
+ return QueryResponse(
371
+ success=True,
372
+ answer=result['result'],
373
+ response_time=response_time,
374
+ query_tokens=query_tokens,
375
+ llm_tokens=llm_tokens,
376
+ session_stats=rag_system.session_stats
377
+ )
378
+
379
+ except Exception as e:
380
+ logger.error(f"API query error: {str(e)}")
381
+ raise HTTPException(status_code=500, detail=str(e))
382
+
383
+ @app.get("/stats", response_model=StatsResponse)
384
+ async def get_stats():
385
+ """Get current session statistics"""
386
+ llm_tokens = rag_system.token_callback_handler.get_total_tokens()
387
+
388
+ return StatsResponse(
389
+ total_queries=rag_system.session_stats["total_queries"],
390
+ total_embedding_tokens=rag_system.session_stats["total_embedding_tokens"],
391
+ total_llm_tokens=llm_tokens["total_llm_tokens"],
392
+ total_llm_calls=llm_tokens["total_llm_calls"],
393
+ initialization_complete=rag_system.session_stats["initialization_complete"]
394
+ )
395
+
396
+ @app.post("/reset")
397
+ async def reset_system():
398
+ """Reset session statistics"""
399
+ reset_session()
400
+ return {"message": "Session reset successfully"}
401
+
402
+ @app.post("/upload-document")
403
+ async def upload_document(
404
+ file: UploadFile = File(...),
405
+ api_key: str = None
406
+ ):
407
+ """Upload a document and initialize the system"""
408
+ try:
409
+ if not api_key:
410
+ raise HTTPException(status_code=400, detail="API key required")
411
+
412
+ # Read uploaded file
413
+ content = await file.read()
414
+ file_content = content.decode('utf-8')
415
+
416
+ # Initialize system with uploaded content
417
+ result = initialize_rag_system(api_key, file_content)
418
+
419
+ if "✅" in result:
420
+ return {"success": True, "message": result}
421
+ else:
422
+ return {"success": False, "message": result}
423
+
424
+ except Exception as e:
425
+ logger.error(f"Document upload error: {str(e)}")
426
+ raise HTTPException(status_code=500, detail=str(e))
427
+
428
+ # Create Gradio interface
429
+ def create_interface():
430
+ with gr.Blocks(title="Maize RAG Q&A System", theme=gr.themes.Soft()) as demo:
431
+ gr.Markdown("""
432
+ # 🌽 Maize Agriculture RAG Q&A System
433
+
434
+ This system uses Retrieval-Augmented Generation (RAG) to answer questions about maize agriculture.
435
+ Upload your own document or use the default maize dataset.
436
+ """)
437
+
438
+ with gr.Row():
439
+ with gr.Column(scale=2):
440
+ api_key_input = gr.Textbox(
441
+ label="🔑 Google API Key",
442
+ placeholder="Enter your Google Generative AI API key",
443
+ type="password",
444
+ info="Get your API key from Google AI Studio"
445
+ )
446
+
447
+ with gr.Column(scale=1):
448
+ reset_btn = gr.Button("🔄 Reset Session", variant="secondary")
449
+
450
+ with gr.Row():
451
+ with gr.Column():
452
+ file_upload = gr.File(
453
+ label="📁 Upload Document (Optional)",
454
+ file_types=[".txt"],
455
+ info="Upload a text file or use the default maize dataset"
456
+ )
457
+
458
+ init_btn = gr.Button("🚀 Initialize RAG System", variant="primary")
459
+ init_output = gr.Textbox(
460
+ label="📋 Initialization Status",
461
+ lines=3,
462
+ interactive=False
463
+ )
464
+
465
+ gr.Markdown("## 💬 Ask Questions")
466
+
467
+ with gr.Row():
468
+ with gr.Column(scale=3):
469
+ query_input = gr.Textbox(
470
+ label="❓ Your Question",
471
+ placeholder="Ask something about maize agriculture...",
472
+ lines=2
473
+ )
474
+
475
+ # Sample questions
476
+ sample_questions = [
477
+ "What are the main pests affecting maize crops?",
478
+ "How should maize be irrigated?",
479
+ "What is the ideal soil type for maize?",
480
+ "What are the nutritional requirements of maize?",
481
+ "When is the best time to harvest maize?"
482
+ ]
483
+
484
+ gr.Examples(
485
+ examples=sample_questions,
486
+ inputs=query_input,
487
+ label="💡 Sample Questions"
488
+ )
489
+
490
+ with gr.Column(scale=1):
491
+ submit_btn = gr.Button("🔍 Ask", variant="primary")
492
+
493
+ with gr.Row():
494
+ with gr.Column(scale=2):
495
+ answer_output = gr.Textbox(
496
+ label="🤖 Answer",
497
+ lines=6,
498
+ interactive=False
499
+ )
500
+
501
+ with gr.Column(scale=1):
502
+ stats_output = gr.Markdown(
503
+ label="📊 Statistics",
504
+ value="Statistics will appear here after queries."
505
+ )
506
+
507
+ # Event handlers
508
+ init_btn.click(
509
+ upload_file_and_initialize,
510
+ inputs=[api_key_input, file_upload],
511
+ outputs=init_output
512
+ )
513
+
514
+ submit_btn.click(
515
+ process_query,
516
+ inputs=[query_input, api_key_input],
517
+ outputs=[answer_output, stats_output]
518
+ )
519
+
520
+ query_input.submit(
521
+ process_query,
522
+ inputs=[query_input, api_key_input],
523
+ outputs=[answer_output, stats_output]
524
+ )
525
+
526
+ reset_btn.click(
527
+ reset_session,
528
+ outputs=init_output
529
+ )
530
+
531
+ gr.Markdown("""
532
+ ## 📝 Instructions:
533
+ 1. **Enter your Google API Key** (required)
534
+ 2. **Upload a document** (optional - uses default maize dataset if not provided)
535
+ 3. **Initialize the RAG system** by clicking "Initialize RAG System"
536
+ 4. **Ask questions** about the document content
537
+ 5. **View statistics** to monitor token usage and costs
538
+
539
+ ## 💰 Cost Information:
540
+ - **Gemini 1.5 Flash**: Input: $0.075/1M tokens, Output: $0.30/1M tokens
541
+ - **Embedding Model**: $0.025/1M tokens
542
+
543
+ Token usage is estimated and displayed for cost tracking.
544
+ """)
545
+
546
+ return demo
547
+
548
+ # Create and launch the interface
549
+ def run_gradio():
550
+ """Run Gradio interface"""
551
+ demo = create_interface()
552
+ demo.launch(
553
+ server_name="0.0.0.0",
554
+ server_port=7860,
555
+ show_error=True,
556
+ quiet=True # Reduce Gradio logs in combined mode
557
+ )
558
+
559
+ def run_fastapi():
560
+ """Run FastAPI server"""
561
+ uvicorn.run(
562
+ app,
563
+ host="0.0.0.0",
564
+ port=8000,
565
+ log_level="info"
566
+ )
567
+
568
+ if __name__ == "__main__":
569
+ import sys
570
+
571
+ if len(sys.argv) > 1:
572
+ mode = sys.argv[1]
573
+
574
+ if mode == "api":
575
+ # Run only FastAPI
576
+ print("Starting FastAPI server on port 8000...")
577
+ run_fastapi()
578
+ elif mode == "gradio":
579
+ # Run only Gradio
580
+ print("Starting Gradio interface on port 7860...")
581
+ run_gradio()
582
+ elif mode == "both":
583
+ # Run both servers
584
+ print("Starting both FastAPI (port 8000) and Gradio (port 7860)...")
585
+
586
+ # Start FastAPI in a separate thread
587
+ fastapi_thread = threading.Thread(target=run_fastapi)
588
+ fastapi_thread.daemon = True
589
+ fastapi_thread.start()
590
+
591
+ # Start Gradio in main thread
592
+ time.sleep(2) # Give FastAPI time to start
593
+ run_gradio()
594
+ else:
595
+ print("Usage: python app.py [api|gradio|both]")
596
+ print("Default: gradio only")
597
+ run_gradio()
598
+ else:
599
+ # Default: run only Gradio (for Hugging Face Spaces compatibility)
600
+ print("Starting Gradio interface on port 7860...")
601
+ run_gradio()
data/maize_data.txt ADDED
@@ -0,0 +1,822 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Maize Production
2
+ for Food, Feed and Fodder
3
+ S.D. Bamboriya
4
+ Mukesh Choudhary
5
+ Alla Singh
6
+ S.L. Jat
7
+ Sujay Rakshit
8
+ ICAR-Indian Institute of Maize Research, PAU Campus
9
+ Ludhiana, Punjab-141 004 ((India)
10
+ Website: https://iimr.icar.gov.in
11
+ Email: director.maize@icar.gov.in,pdmaize@gmail.com
12
+ Phone: +91-161-2440047-48, Fax: +91 161 2430038
13
+ Citation: S.D. Bamboriya, Mukesh Choudhary, Alla Singh, S.L. Jat and Sujay Rakshit.
14
+ Maize production for food, feed and fodder. IIMR Technical Bulletin
15
+ 2020/2.Indian Institute of Maize Research, PAU Campus, Ludhiana-
16
+ 141004.
17
+ Published in 2020
18
+ Published by:
19
+ ICAR-Indian Institute of Maize Research
20
+ PAU Campus, Ludhiana, Punjab- 141 004 (India)
21
+ Website: https://iimr.icar.gov.in
22
+ Email: director.maize@icar.gov.in,pdmaize@gmail.com
23
+ Phone: +91-161-2440047-48, Fax: +91 161 2430038
24
+ Printed by:
25
+ Azad Offset Printers : # 144, Press Site, Indl. Area-1, Chandigarh
26
+ Tel. : 0172-4611489, 2656144, 2657144
27
+ Email: aop144@gmail.com
28
+ FOREWARD
29
+ Maize (Zea mays L.), the queen of cereals, surpasses all other food crops in its ability to
30
+ adapt to the diverse agro-ecological niches and being cultivated from 58oN to 55oS
31
+ latitude. It is the leading cereal crop in the world with more than one billion tonne
32
+ production. In India, it holds third rank among the cereals, after rice and wheat in terms
33
+ of area and production. Traditionally, maize is grown as a kharif crop in India, but from
34
+ 1970s its expansion started in rabi season and later on in the spring season too. Now,
35
+ the crop is grown round the year and in all agro-ecologies throughout India, not only for
36
+ grain but also for specialized purposes like sweet corn, baby corn and for silage
37
+ making.
38
+ Maize is widely used as food, feed, fodder, industrial raw material and in recent past for
39
+ bio-fuel production. It is a key crop in doubling farmers' income as maize can be
40
+ integrated effectively with dairy, poultry, fisheries and piggery. Speciality corns has a
41
+ special role in value chain development. Considering the changing food habits in India,
42
+ the demand of maize is supposed to increase in the near future. To meet the growing
43
+ demand, there is a need to enhance maize productivity through adoption of the best
44
+ production practices by the maize farmers.
45
+ I am happy to know that ICAR-Indian Institute of Maize Research, Ludhiana is
46
+ bringing out a publication on ''Maize production for food, feed and fodder'' which have
47
+ complete cultivation information for normal and specialty maize right from the sowing
48
+ to harvesting. I congratulate the authors for their contributions in bringing out this
49
+ comprehensive and important publication. I am sure that this publication will be useful
50
+ for researcher, farmers and other stakeholders for enhancing the maize production and
51
+ productivity in the country.
52
+ (T R Sharma)
53
+ E-mail:ddgcs.icar@nic.in Phone:91-11-23382545 Fax:91-11-23097003
54
+ PREFACE
55
+ Declining water resources, degrading soil health, higher production cost, lesser
56
+ profitability and climate change are the major challenge before Indian agriculture.
57
+ Resource use smart crops which can give more profit from lesser resources are need of
58
+ the hour. Maize is one such crop with highest production potential and comparatively
59
+ lesser water foot-prints. It is a multi-purpose crop being used as food, feed, fodder, and
60
+ raw material for various industrial products including bio-fuels.
61
+ Maize is the leading cereal crop in the world with more than one billion tonne
62
+ production and in India it holds third rank after rice and wheat in terms of area and
63
+ production. Traditionally maize in India used to be consumed as food crop. However,
64
+ over time maize has become rather an industrial crop than food crop as over 75% of the
65
+ maize produced in India is used for industrial purchases, mostly as feed and source of
66
+ starches. Being industrial in nature maize can ensure higher remuneration. Further,
67
+ specialty corns, baby corn and sweet corn with short to medium duration cropping
68
+ period can play important role in diversification in peri-urban agricultural systems and
69
+ nutritional garden. They fit well in integrated farming system, where the byproduct of
70
+ specialty corn, i.e. green fodder can support livestock very well. During last 50 years,
71
+ maize productivity has increased from around 0.99 t/ha to 3.1 t/ha but still we are far
72
+ behind leading maize producing nations. Lesser adoption of improved production
73
+ practices is one among the key factors contributing low productivity of Indian maize,
74
+ besides prevalence of rainfed growing condition, limiting effects of various biotic and
75
+ abiotic stresses among others. Improved high yielding cultivars coupled with better
76
+ crop management is bound to increase productivity of maize in India.
77
+ The compiled production practices of various types of maize is expected help to
78
+ researcher, extension workers and farmers in enhancing maize production and
79
+ productivity in the country.
80
+ Authors
81
+ April 2020
82
+ Ludhiana (Punjab)
83
+ Table of Content
84
+ Parts Description Page No.
85
+ Part I Introduction
86
+ Part II Maize for grain purpose
87
+ Irrigated kharif maize
88
+ Rainfed kharif maize
89
+ Irrigated rabi maize
90
+ Irrigated spring maize
91
+ Part III Specialty maize
92
+ Pop corn
93
+ Baby corn
94
+ Sweet corn
95
+ Maize for green cob
96
+ Part IV Maize as fodder
97
+ Green fodder maize
98
+ Silage maize
99
+ Part V Zero till and conservation agriculture based maize
100
+ Part VI Recommended public sector maize varieties
101
+ Maize Production for Food, Feed and Fodder
102
+ Introduction
103
+ Climate change has far serious implications concerning the food and nutritional security of nations
104
+ like India where agriculture is the backbone of nation's economy and growing population is the
105
+ biggest reason to worry. Rural India largely depends on its natural resources and farming for
106
+ earning its livelihood and food security and climate change affects the natural ecosystem
107
+ progressively. In future, it will be even more difficult to predict occurrences of phenomena such as
108
+ droughts, floods, cloud bursts, etc. due to climate change. Consequently, farmers must adapt to the
109
+ changing climate to ensure optimum crop yields and farm income. Farmers in general and small and
110
+ marginal farmers in particular must enhance the resilience of agriculture to face the upcoming
111
+ challenges. Transforming agriculture through adoption of climate resilient practices and
112
+ technologies would be inevitable to stabilize agricultural production and enhance farmer's income.
113
+ Participatory demonstration of location specific and climate smart technologies is
114
+ necessary for enabling farmers to cope climatic variability and extreme weather phenomenon.
115
+ Adoption and spread of these climate resilient technologies would help farmers fetch adaption
116
+ gains and reduce the Green House Gas (GHG) emissions alongside. Considering the urgent need to
117
+ address the issue of climate change at the farm level, Indian Council of Agricultural Research
118
+ (ICAR) launched National Initiatives in Climate Resilient Agriculture (NICRA) in February, 2011,
119
+ which was renamed as National Innovations in Climate Resilient Agriculture (NICRA) to
120
+ emphasize the role of evolving innovations. Resilience is the capability of the production system to
121
+ resist negative impacts of climate change and also the capacity to recover quickly after the damage.
122
+ Therefore, National Innovations in Climate Resilient Agriculture (NICRA) was formulated to
123
+ develop and demonstrate region specific improved technologies that would enhance the resilience
124
+ of Indian agriculture to climate change thereby addressing climate vulnerability and its negative
125
+ impacts. The emphasis on adaptation to climate variability necessitates appropriate responses to
126
+ contingency situations. Considering the need to enhance the resilience of Indian agriculture
127
+ production system to climate variability and climate change, the center theme should be the
128
+ Sustainability of the production systems facing natural resource degradation. Thus, the centre of
129
+ attraction in NICRA is not the enhancement of productivity but the ability of the existing system to
130
+ cope with the vulnerability and to improve the natural resource use efficiency for sustaining the
131
+ productivity gains that have been achieved already. The project aimed to enhance resilience of
132
+ Indian agriculture to climate change and climate variability through its different components
133
+ namely Strategic Research, Technology Demonstration, Capacity Building and
134
+ Sponsored/Competitive Grants.
135
+ 1
136
+ Uses of Maize
137
+ Feed
138
+ Approximately 60% of total maize production in India is used for preparation of concentrated feeds
139
+ for cattle, poultry and piggery as source of energy. Fishery feed also uses maize as an important
140
+ component. The yellow colour of maize is very useful in providing yellow colour to egg yolk and
141
+ yellow tinge to the milk.
142
+ Food
143
+ Grain maize, pop corn, baby corn, sweet corn and green maize cobs are widely used as human food.
144
+ Most commonly used forms are as Chapattis, porridges, corn flakes, boiled or roasted green ears,
145
+ pop corn, baby corn products like salad, vegetable, pickle, pakoda, kheer, laddu and halwa; sweet
146
+ corn products like soup, chat, corn cheese balls, masala corn and salad etc. Around 13% of total
147
+ maize grain production in India is used as food and 7% as processed food, however this does not
148
+ include use of specialty maize, particularly baby corn, sweet corn and green cobs.
149
+ Industrial uses
150
+ Maize acts as a raw material in the manufacture of starch, syrup, dextrose, oil, gelatine etc. Corn
151
+ flour is used as a thickening agent in the preparation of many edibles like soups, sauces and custard
152
+ powder. Corn syrup is used as sweetener in processed foods such as soft drinks and candies. Corn
153
+ sugar (dextrose) is used in pharmaceutical formulations. Maize oil is widely used as a cooking
154
+ medium and it has the quality of reducing cholesterol in the human blood. Maize oil has use in
155
+ cosmetics and pain industry as well. Corn gel because of its moisture retention character is used as a
156
+ bonding agent for ice-cream cones. Maize stalks are made into paper and wall board; husks are used
157
+ as filling material; cobs are used directly for fuel, to make furfurol, fermentable sugars, solvents,
158
+ liquid fuels, charcoal, pulp, paper and hard boards. Approximate 14% of total maize production in
159
+ India is utilised for industrial purposes.
160
+ Bio fuel and bioplastic
161
+ Maize is also used for liquid bio-fuel (ethanol) production in USA. The ethanol is used as
162
+ transportation fuel after blending with gasoline. India is also slowly opening up use of maize grain
163
+ for ethanol production. The maize starch is also used for making biodegradable plastic using poly
164
+ lactic acid (PLA) which will be very useful in the scenario of banning single use of plastic.
165
+ Forage and silage
166
+ Maize stalk is used to feed dairy animals in the form of green fodder, dry roughages andsilage.
167
+ Maize fodder has higher digestibility than any other non-leguminous forage crops and it does not
168
+ contain any toxic substances. Maize is also preferred for silage making over other fodders, as maize
169
+ plant is easy to chaff, requires less labour and its silage is soft.
170
+ 2
171
+ Brief Cultivation Facts
172
+ A. Maize for grain
173
+ A.1. Irrigated kharif maize
174
+ Sowing time: Generally, the ideal sowing time is June 20 to end of July. However, in fields where
175
+ water stagnation may occur, early sowing is desirable so that plant reaches a firm stand to avoid
176
+ lodging associated with water logging.
177
+ Soil: Maize is very sensitive to water-logging and considerable yield losses occur if, the crop faces
178
+ water-stagnation for more than two days. Hence, it is better to plant the crop on well-drained sandy-
179
+ loam to silty-loam soils.
180
+ Land preparation: Maize needs well pulverized and smooth field for quick seed emergence and
181
+ root growth. Hence, two harrowing followed by one planking is needed for field preparation and
182
+ early season weed management. Maize can also be successfully produced under zero-till conditions
183
+ using happy seeder or zero till multi-crop planter.
184
+ a b
185
+ Fig: Land preparation (a) harrowing; (b) land leveling
186
+ Farm-equipments: Mould board plough (MB plough), disc or tine harrow, land-leveler, maize
187
+ planter, narrow bed planter, pneumatic planter, wide bed planter etc.
188
+ 3
189
+ a b
190
+ c d
191
+ Fig: Maize planting equipment (a) Ridge planter; (b) Maize planter;
192
+ (c) Pneumatic planter; (d) Wide bed planter
193
+ Seed rate and seed treatment: Eight kg seed of field corn is needed for seeding in one acre area.
194
+ Seeds should be treated with any of the following fungicides and insecticides before sowing to
195
+ protect the crop from most prevalent (seed and soil borne) diseases and insect-pests.
196
+ 1) Bavistin + Captan in 1:1 ratio@2g/kg seed for Turcicum leaf blight, Banded leaf and sheath
197
+ blight, Maydis leaf blight etc.
198
+ 2) Apran 35 SD@4g/kg seed for Brown stripe downy mildew
199
+ 3) Captan 2.5g/kg for Pythium Stalk Rot
200
+ 4) Imidachlorpid (Gaucho) @ 6 ml/kg or Fipronil @4ml/Kg seed for termite and shoot fly.
201
+ 5) Thiamethoxam + Cyantraniliprole @ 4 ml/kg seed for fall armyworm.
202
+ Any of the above seed treatment may be selected depending upon predominant biotic stresses.
203
+ Sowing method: In kharif sown maize, raised bed planting is recommended to protect the crop
204
+ from water logging. In raised bed planting, 70 cm wide ridges (40 cm ridge and 30 cm furrow) are
205
+ prepared with the help of bed planter. Bed planter with incline plate seed metering system can
206
+ precisely place the maize seed at required depth and does simultaneous operation of raised beds
207
+ making and planting. One line of maize on each raised bed is desirable when sole crop of maize is
208
+ planted keeping seed to seed spacing at 20 cm. Optimum plant density (30,000/acre) should be
209
+ maintained to tap full potentials of hybrids. Southern side planting is advised on East-West oriented
210
+ 4
211
+ ridges. Happy seeder or zero-till bed planters with inclined plate to be used for crop establishment
212
+ under zero tillage or for sowing under crop residue.
213
+ Sowing depth: For proper germination and early vigor, seed should be sown at 3.5-5.0 cm depth.
214
+ Inter cropping: One row of either (a) Cowpea for fodder; (b) Soybean/urdbean/mungbean for
215
+ grain; (c) Groundnut for pods, in between two consecutive rows of maize is desirable for inter-
216
+ cropping with maize. The shade loving crops like turmeric and ginger can also be successfully
217
+ cultivated as intercrop with maize. Herbicides should not be used for weed control in inter-cropping
218
+ system. In case of intercropped maize slightly higher doses of fertilizers should be applied than
219
+ sole crop.
220
+ Irrigation management: Water requirement of maize is 500–800 mm per growing season. During
221
+ kharif season, partially water requirement is met by rainfall. Hence, 1-4 irrigations are required,
222
+ which may vary depending on frequency of rainfall. Adequate moisture at germination, pre-
223
+ tasseling, silking and grain-filling stages should be ensured through irrigation, if rainfall is not
224
+ there. If available, the sprinkler irrigation up to knee length stage is very good for maize crop. In
225
+ ridge-sown crop, irrigation should be given in furrow up to 2/3 of height of the ridge.
226
+ Nutrient management: Hybrid maize is very responsive to nutrient application and has slightly
227
+ high nutrient requirement as compare to other cereals due to high yield potential. It can be grown
228
+ both organically or by integrated nutrient management involving organic and inorganic nutrient
229
+ supplementation.
230
+ Organic nutrient management: Following options for nutrient management in organic maize
231
+ production to be used based on availability in suitable combination
232
+ l Green manuring: Green manuring crops like dhaincha/sunhemp/cowpea at 12/20/20 kg
233
+ seed rate/acre, respectively are very useful. Fifty days old crop is to be ploughed down
234
+ and reserve the field for 10 days for decomposition before sowing of maize.
235
+ l Straw of summer mungbean/cowpea may be buried before sowing of maize
236
+ l Farm yard manure/Compost @ 6 tonnes/acre or vermicompost @ 3 tonnes/acre
237
+ l Application of Azatobacter/Azospirillum with PSB and NPK consortia for seed
238
+ treatment @ 200 g/acre or liquid formulation @ 100 ml/acre.
239
+ Integrated nutrient management: Application of 6 tonnes/acre well decomposed farm yard
240
+ manure/compost mixed with Azatobacter/Azospirillum with PSB, VAM and NPK consortia @ 5-6
241
+ kg/acre or seed treatment with Azatobacter/Azospirillum with PSB and NPK consortia @ 200 g
242
+ each/acre or liquid formulation @ 100 ml/acre needed for better moisture retention and initial boost
243
+ of the crop. Macro- and micro-nutrient requirements of the crop need to be accomplished through
244
+ use of suitable fertilizers. The following schedule of fertilizer may be used:
245
+ 5
246
+ Crop Stage Fertilizers scheduling
247
+ Sowing (Basal) Drill full dose of P, K and 1/3 of N-fertilizer dose, micro-
248
+ nutrient application
249
+ Knee-high (Ist split) Top dress 1/3 N-fertilizer dose and micronutrient spray
250
+ Pre-tasseling (2nd split) Top dressing of remaining 1/3 N-fertilizer dose and micro-
251
+ nutrient spray
252
+ Rate of different fertilizers
253
+ Fertilizer (kg/acre)
254
+ Varieties Sehedule
255
+ Urea DAP MOP ZnSO.7HO
256
+ Long duration Basal 23 52 27 10
257
+ hybrid
258
+ Ist split 44 -- -- --
259
+ 2nd split 44 -- -- --
260
+ Short duration Basal 14 35 20 10
261
+ hybrid, composite Ist split 26 -- -- --
262
+ 2nd split 26 -- -- --
263
+ Maize is sensitive to Zinc deficiency. Zinc deficient crop shows stunted growth and develop short
264
+ inter-nodes. A white (or pale-yellowish) tissue with reddish veins appears on leaf blade. To mitigate
265
+ it 10 kg/acre ZnSO4.7H2O or 6.5 kg/acre ZnSO4.H2O should be applied at sowing. Apply 10-15
266
+ kg Sulphar and 0.5 kg Boron/acre in deficient soils.
267
+ Fig: Zinc deficiency symptoms in maize
268
+ 6
269
+ Weed management: Weeds significantly affect maize production and the critical period for crop-
270
+ weed completion is 15-45 days after sowing.
271
+ Cultural control of weeds: a) Two manual hoeing at 15 and 30 DAS; b) Inter-cropping of one or two
272
+ rows of fodder cowpea in between maize rows reduces weed problem considerably; c) Always use
273
+ weed free seeds for sowing; d) Do not spread un-decomposed compost in field because it may
274
+ contain viable weed seeds; e) Do not allow the seed formation of weeds in fields.
275
+ Chemical control of weeds: Pre-emergence Atrazine application @ 400 g ai/acre followed by one
276
+ hand weeding at 35-40 days gives good weed control. Recommended dose of Atrazine at pre-
277
+ emergence followed by either of the post-emergence herbicide (mentioned below) for effective
278
+ weed control is also equally effective.
279
+ a b
280
+ Fig: (a) Maize field after weeding; (b) Maize field after Tembotrione spray
281
+ 7
282
+ Selective herbicides for maize
283
+ Herbicide Formulations Dose Time of application (DAS)
284
+ (g a.i./acre)
285
+ Atrazine 50% WP 400 0-2 (pre-emergence)
286
+ Topramezone 33.6% SC 10 20-30 (Post emergence)
287
+ Tembotrione 34.4% SC 48 20-30 (Post emergence)
288
+ Precautions:
289
+ l Use flat fan nozzle for herbicide spray.
290
+ l Do not use under/over dose of herbicide.
291
+ l While spraying weedicide sprayed field should not be stepped on, i.e. the farmer should move
292
+ backward or sidewards.
293
+ Saving crop in case of excess water damage: If water logging occurs in the field and damage is
294
+ moderate, 6 kg/acre of urea in two sprays at weekly intervals may be applied. In case of moderate to
295
+ severe damage, 25-50 kg urea/acre after the water flooding is over may be broadcasted.
296
+ a b
297
+ Fig: (a) Water-logged maize field (b) Growth reduction due to water-logging
298
+ Plant Protection
299
+ Major diseases: Maydis Leaf Blight (MLB), Bacterial Leaf and Sheath Blight (BLSB), Charcoal
300
+ Rot (CR), Bacterial Stalk Rot (BSR), Rajasthan Downey Mildew (RDM), Curvularia Leaf Spot
301
+ (CLS), Post Flowering Stalk Rot (PFSR), Brown strip Downey Mildew (BSDM) and Common
302
+ Rust are major diseases of maize.
303
+ 8
304
+ a b c
305
+ d e f
306
+ g h i
307
+ Fig: Maize diseases (a) Maydis leaf blight; (b) Charcoal Rot; (c ) Bacterial stalk rot; (d) Rajasthan
308
+ downey mildew; (e ) Curvularia leaf spot; (f) Bacterial leaf and sheath blight ; (g) Post flowering
309
+ stalk rot; (h) Brown strip downey mildew; (i) Common rust
310
+ 9
311
+ Disease management in maize
312
+ Disease Cultural control Chemical control
313
+ Maydis Deep ploughing of previous A) Seed treatment with Bavistin + Captan
314
+ leaf blight crop residue through in 1:1 ratio @ 2.0 g/kg seed
315
+ B) Spray Dithan Z-78 or Zineb @ 2.4-4
316
+ g/litre water and repeat the spray at 8-
317
+ 10 days interval
318
+ C) Grow MLB resistance varieties, if the
319
+ disease incidence is regular
320
+ Bacterial Stripping of two lower leaves A) Seed treatment with Bavistin + Captan
321
+ leaf and along with leaf sheath in 1:1 ratio @ 2.0 g/kg seed
322
+ sheath B) Spray of Sheethmar (Validamycin) @
323
+ blight A). Deep ploughing, 2.7 ml/litre water
324
+ Charcoal
325
+ B). Crop rotation
326
+ rot
327
+ C). Maintain proper moisture
328
+ during flowering
329
+ Bacterial Stripping of two lower leaves A) Seed treatment with metalaxyl
330
+ stalk rot along with leaf sheath (Ridomil 25 WP, Apron 35 SD) @ 2.5
331
+ Rajasthan g/kg
332
+ A). Field sanitation
333
+ downey B) Foliar spray of metalaxyly (Apron 35
334
+ mildew B). Destroy infected plant FN) @ 2-2.5 g/liter of water at very first
335
+ appearance of disease
336
+ Curvularia A) Spray (Carbendazim 12% + mecozeb
337
+ leaf spot 62.7%) @ 2 g/liter water 35 and 55
338
+ DAS
339
+ B) If zineb is available, then spray Zineb
340
+ 75% @ 2 g/liter at 35 and 55 DAS
341
+ 10
342
+ Disease Cultural control Chemical control
343
+ Post A) Maintain optimum plant - - -
344
+ flowering population
345
+ stalk rot B) Avoid excess N
346
+ C) Follow crop rotation with
347
+ non-host crop like soybean
348
+ D) Manage attack of stem borer
349
+ as their injury predisposes
350
+ to stalk rot
351
+ Brown A) Field sanitation A) Seed treatment with metalaxyl
352
+ strip B) Destroy infected plants (Ridomil 25 WP, Apron 35 SD) @ 2.5
353
+ downey g/kg
354
+ C) Weed control
355
+ mildew B) Foliar spray of metalaxyly (Apron 35
356
+ D) Maintain optimum plant
357
+ FN) @ 2-2.5 g/litre of water at very
358
+ stand
359
+ first appearance of disease
360
+ E) Planting before rainy
361
+ season
362
+ F) Maintain low seed moisture
363
+ (9%) at planting
364
+ Common A) Field sanitation Spray Diathane M-45 @ 2.4-4 g/litre
365
+ rust B) Destroy infected plants water and repeat the spray at 8-10 days
366
+ interval
367
+ C) Weed control
368
+ D) Maintain optimum plant
369
+ stand
370
+ E) Planting before rainy
371
+ season
372
+ F) Maintain low seed moisture
373
+ (9%) at planting
374
+ Major Insect Pests: Maize stem borer, Pink stem borer, Shoot fly and Fall army worm are major
375
+ pest of maize Among these pests, Maize stem borer occurs in kharif, Pink stem borer in rabi and
376
+ Shoot fly in spring season.
377
+ 11
378
+ a b
379
+ c d
380
+ e f
381
+ 12
382
+ a b
383
+ Fig: Mazie pests (a) Maize stem bore; (b) Damage symptoms Maize stem borer; (c ) Fall armyworm
384
+ larvae; (d) Damage symptoms of FAW; (e ) Pink stem borer; (f) Damage symptoms of Pink stem
385
+ bore; (g )Shoot fly; (h) Damage symptoms of Shoot fly
386
+ Management of maize pests
387
+ Pest Cultural control Chemical control Biological control
388
+ Maize Stem Grow cowpea in Spray the crop with Use Trichocards
389
+ Borer (Kharif between maize rows chemicals like (Trichogrammachilonis)
390
+ season pest) and as intercrop against Chlorantraniliprole on 15 days old crop @ 3
391
+ Pink stem borer Maize stem borer. 18.5% SC @ 60 ml cards per acre
392
+ (rabi season pest) per acre at 15-18 DAS
393
+ Border planting of Place a pinch of
394
+ sorghum (3-4 rows) Carbofuran 3% G in
395
+ around maize crop whorl of infested
396
+ against Maize stem maize plant at initial
397
+ borer. stage of infestation
398
+ 13
399
+ Pest Cultural control Chemical control Biological control
400
+ Fall Army Worm Choose cultivars Whorl application of Whorl application of
401
+ with tough husk either of pesticide either of biological
402
+ cover formulations at 15-25
403
+ days after sowing
404
+ Border planting of A) Spinetoram11.7% A) 5% NSKE or
405
+ sorghum (3-4 rows) SC @ 0.5ml/l azadirachtin 1500
406
+ around maize crop ppm @ 5 ml/litre
407
+ against Maize stem B) Thiamethoxam B) Metarhizium
408
+ borer. 12.5% + Lambda anisopliae talc
409
+ Cyhalothrin 9.5% formulation (1x108
410
+ ZC @ 0.25 ml/l cfu/g) @ 5g/litre
411
+ C ) C) Nomuraea rileyi rice
412
+ Chlorantraniliprol grain formulation
413
+ e 18.5% SC @ 0.4 (1x108 cfu/g) @
414
+ ml/l 3g/litre
415
+ D) Btk formulation @
416
+ D) E m a m e c t i n 2ml/l of water
417
+ benzoate 5 SG @
418
+ 0.4 g/l
419
+ Intercropping with -- Release of Tricho-
420
+ pulses and other gramma pretiosum @
421
+ non-host crop 50000 Or Telenomus
422
+ remus @ 10,000 per
423
+ acre at weekly intervals
424
+ Shoot fly Early planting in A) Seed treatment --
425
+ (spring) first week of with Imidacloprid
426
+ February 600 FS (Gaucho)
427
+ @ 6 m l / k g o r
428
+ Thiomethoxam 30
429
+ FS @ 8ml/kg seed.
430
+ B) Soil application of
431
+ Furadan (Carbo-
432
+ furan3G) @ 8-10
433
+ kg per acre in the
434
+ furrow during
435
+ sowing is also
436
+ helpful agains
437
+ 14
438
+ Application of nitrogen and irrigation after control measures helps in faster recovery from pest
439
+ damage.
440
+ Bird management: Nearly ten bird species feed and damage maize cobs. The yield loss due to bird
441
+ feeding is huge and ranges between 10 to 40% in the case of maize crop. To reduce the damage by
442
+ Parakeets and crows, cover maize cobs by wrapping adjacent green leaves around them on outer
443
+ four rows of the field. Acoustic devices also available in market which keep away depredatory birds
444
+ from fields by producing recorded sounds. These devices produce natural sound of bird predators
445
+ and alarm call of pest birds. Thus, the pest birds avoid the broadcast area. Beside this, reflective
446
+ ribbons also scare birds through reflection of sunlight and humming noise produced by the wind.
447
+ Harvesting and shelling: Maize can be harvested when the husk has dried and turned brown. Apart
448
+ from hand-picking, combined harvester may also be used for quick harvesting. After manual
449
+ harvesting, depending upon the cultivated area, manual shellers or maize dehusker-cum-sheller or
450
+ maize thresher may be used for separating grains from cobs.
451
+ Fig: Combine harvesting in maize
452
+ Grain drying: During harvesting of maize, grain moisture content is quite high (~30-35%). Due to
453
+ higher moisture content farmers cannot get good price of their produce. Beside this, storage at high
454
+ grain moisture creates problems of fungal infection and can cause heating and loss of germination.
455
+ Hence, after crop harvesting, produce drying is very much essential. Portable Maize Dryer can be
456
+ used for reducing the moisture content of the cobs. It is tractor or electricity driven, portable and
457
+ long lasting dryer. It can dry any type of grain and do not need pre-cleaning of grains. Its drying rate
458
+ ranges between 2-10 t/h depending on crop type, grain moisture content etc. The optimum moisture
459
+ in grain for long-term storage should be below 14%. Sun drying of the cobs and seeds is required in
460
+ absence of other drying options prior to marketing as moisture above optimum level reduces market
461
+ prices and increases chance of aflatoxin contamination.
462
+ 15
463
+ Fig: Mobile batch dryer
464
+ Grain storage: Large scale kharif maize harvesting during October-November and rabi maize in
465
+ April-May months, result in price drop. Hence, to fetch better price, farmers generally store their
466
+ produce for higher profitability. But, the higher atmospheric humidity, cloudy weather and higher
467
+ grain moisture content leads to fungal infection and physical deterioration of maize grain. Hence,
468
+ proper drying followed by moisture proof storage are very much needed for long term storage of
469
+ maize grains. Pusa bin and metal bin are some cost-effective and moisture proof storage structures
470
+ which can be used by maize farmers. Pusa bin is modification of ordinary mud storage structure. It
471
+ is rectangular in shape and constructed of bricks and earth. To make it moisture proof, a plastic film
472
+ (700 gauge) is used all around ((inner side) of bin. It can store up to 3 tonnes of well dried grains for
473
+ longer period with minimum loss. Metal bin is moisture proof storage structure and made of steel or
474
+ aluminium. The bin is durable and also commercially available. Its storage capacity ranges from 1
475
+ to 10tonnes. Hermatic cocoons are another storage container having two plastic half-joined
476
+ together with a air tight zip. It is made up of thin and ultra low permeable plastic with 500 times
477
+ lesser permeability to oxygen than normal plastic. The air tight container prevent development of
478
+ storage pest as it block respiration of pest (due to low oxygen). It does not allow moisture
479
+ movement hence also prevent aflatoxin problem.
480
+ Store grain pest management: Rice weevil and Angoumois grain moth are major pest of maize
481
+ during storage. Following point should keep in mind during storage.
482
+ l The moisture content of grain should be less than 12%.
483
+ l Clean the storage bins before using them for storage.
484
+ l Newer grains should not be mixed with older ones.
485
+ l Staggered sun drying with short exposure to sun spread reduces insect infestation.
486
+ 16
487
+ l Use of plant products such as Adathoda vasica, Azadirachta indica, Vitex negundo,
488
+ Catharanthus roseus @ 2% w/w (20g /kg seed) have been found to be effective against storage
489
+ pests.
490
+ A.2. Rainfed kharif maize
491
+ Sowing time: In rainfed regions sowing time is rain dependent and should be done just after
492
+ monsoon occurance in end of June to second fortnight of July.
493
+ Seed rate and spacing requirement in rainfed maize
494
+ Seed rate (kg/acre) Spacing (cm) Plant population (per acre)
495
+ 7-8 70 x 20 -25 23,134 to 28,918
496
+ Fertilizer scheduling: Organic nutrient supplementation to be given and inorganic N fertilizers is
497
+ to be splitted into two doses, at basal and depending on moisture availability between knee high to
498
+ tasseling stage.
499
+ Rate of different fertilizers needed for rainfed maize crop
500
+ Fertilizer (kg/acre)
501
+ Soil Type Schedule
502
+ Urea DAP ZnSO4.7H2O
503
+ Sandy loam to clay loam Basal 46 35 10
504
+ soil with adequate 1st split
505
+ moisture stored 24 -- --
506
+ Loamy sand to sandy Basal
507
+ 35 18 --
508
+ soils with low moisture
509
+ 1st split
510
+ stored
511
+ -- -- --
512
+ Soil moisture conservation: For rainfed crops, soil moisture is the most limiting factor. Hence,
513
+ moisture conservation practices are required to be followed to attain maximum yield.
514
+ 17
515
+ Soil moisture conservation practice.
516
+ l Plough the field against slope after pre-monsoon showers to enhance water
517
+ absorption/filtration
518
+ l Sowing and other operations should be carried out on contour/across the slope
519
+ l Spread locally available mulching material in the last week of August
520
+ l Application of the farm yard manure/compost @ 5-6 tonnes/acre
521
+ Rest agronomic practices are same as discussed earlier.
522
+ A.3. Rabi maize
523
+ Sowing time: 15th October to 15th November is the best time, however this may vary for region to
524
+ region.
525
+ Sowing method: Before sowing, seed should be soaked overnight in warm (45oC at the time of seed
526
+ soaking) water. This treatment helps in obtaining better plant stand and healthy crop. Sowing
527
+ should be done on the southern side of the east-west ridge so that the optimum amount of sunshine is
528
+ received and the seedbed remains warm.
529
+ Seed rate and spacing requirement in rabi maize
530
+ Seed rate (kg/acre) Spacing (cm) Plant population (per acre)
531
+ 20-22 60 x 20 33,333
532
+ Intercropping: During the rabi season potato, table pea, onion, garlic, coriander, spinach,
533
+ coriander, beetroot, cabbage etc. can be grown in between maize rows to ensure higher income of
534
+ growers without harming the yield of winter maize.
535
+ Fertilizer scheduling: The following fertilizer schedule should be used to get higher yield.
536
+ Crop stage Schedule Fertilizer (kg/acre)
537
+ Urea DAP MOP ZnSO.7HO
538
+ 4 2
539
+ Before at sowing Basal
540
+ 26 70 40 10
541
+ 4 leaf stage 1st split 26 - - -
542
+ 8 leaf stage 2nd split 40 - - -
543
+ Tasseling stage 3rd split 26 - - -
544
+ Grain filling stage 4th split 6 - - -
545
+ 18
546
+ Irrigation management: Four to six irrigations are needed for rabi season crop. If six irrigations
547
+ are given, they should be applied as two before flowering, one at the time of flowering, two after
548
+ flowering and one at the early grain-filling stage. If only five irrigations are given, one irrigation at
549
+ the vegetative stage may be avoided; and if only four irrigations are given, irrigation after the dough
550
+ stage may be avoided. The irrigation should, however be changed suitably if adequate rains are
551
+ received. Rest management practices are similar to irrigated maize.
552
+ A.4. Spring maize
553
+ Sowing time: January 20 – February 20 is ideal sowing time for spring maize planting.
554
+ Sowing method: Evaporative losses of water during spring season from the soil under flat as well
555
+ as raised bed planting is higher and hence crop suffers from moisture stress. Under such conditions,
556
+ it is always advisable to grow maize in furrows for proper growth, seed setting and higher
557
+ productivity. Zero-till planning is beneficial in spring maize after harvesting of potato, mustard etc.
558
+ Irrigation: Spring maize needs nearly 10-15 irrigations sometimes even higher as the evapo-
559
+ transpiration demand is quite higher in summer season. Hence, a water use-efficient irrigation
560
+ system i.e. drip method is desirable under spring sown maize. Apply first irrigation at 25-30 DAS.
561
+ Under non-drip irrigation, apply irrigation at 2 weeks interval upto10th April and on per week basis
562
+ after this, up to maturity. From water conservation point of view spring maize without drip
563
+ irrigation is not recommended.
564
+ Fertilizer scheduling: For higher yield, integrated nutrient management found beneficial for
565
+ spring maize and organic sources option mentioned in kharif maize to be used along with chemical
566
+ fertilizer mentioned as below:
567
+ Rate of different fertilizers needed
568
+ Varieties Schedule Fertilizer (kg/acre)
569
+ Urea DAP MOP ZnSO.7HO
570
+ 4 2
571
+ Medium duration Basal 33 55 27 10
572
+ hybrid 1st split 33 -- --
573
+ 2nd split 33 -- --
574
+ Medium duration Basal 25 27 27
575
+ hybrid 1st split 25 -- --
576
+ 2nd split 25 -- --
577
+ Rest management practices are similar to irrigated kharif maize for grain purpose.
578
+ 19
579
+ B. Specialty corn/special purpose maize
580
+ B.1. Pop corn
581
+ Pop corn cultivation practices are similar to grain purpose as discussed earlier except the pop corn
582
+ cultivars are shorter of duration (80-90 days). However, as a premier crop preferably to be grown
583
+ under irrigated conditions. This crop needs isolation of at least 400 m from normal maize as
584
+ pollination with normal maize deteriorates its popping quality. Generally, 10-15 days isolation in
585
+ sowing time also ensures quality pop corn. As the plant type of the pop corn is weak and affected
586
+ more by diseases and pest and thus should be preferably to be grown in mild climate i.e. winter
587
+ season/hilly areas for better yield and quality.
588
+ Seed and spacing requirement Seed and spacing requirement
589
+ Seed rate (kg/acre) Spacing (cm) Plant population (per acre) Seed rate (kg/acre) Spacing (cm) Plant population (per acre)
590
+ 4 - 5 60 x 20 33,724 4 - 5 60 x 20 33,724
591
+ Rest management practices are similar to irrigated maize for grain purpose.
592
+ B.2. Baby corn
593
+ It is shortest duration maize crop and gets ready for harvesting within two months of planting and
594
+ harvested in 60-70 days during kharif and 80-100 days in rabi season. This crop needs isolation of at
595
+ least 400 m from normal maize as pollination deteriorates its quality. Generally, 10-15 days
596
+ isolation in sowing time also ensures quality baby corn. Detasseling is needed in baby corn for
597
+ quality assurance. It is done by removing the tassel of the plant as soon as it emerges from the flag
598
+ leaf. It should be practiced row-wise. While detasseling, leaf should not be removed which will
599
+ otherwise affect net photosynthesis and ultimately reduce average baby corn yield. However, this is
600
+ not needed when male sterile baby corn cultivars are chosen for cultivation. Harvesting should be
601
+ done in morning or evening and stored under cool conditions in shed. After dehusking cobs should
602
+ preferably kept under wrap and refrigerated. The crop should be harvested after 1-3 days of silk
603
+ emergence. The remaining plant portion (tassels, main stem, husks) serves as nutritious green
604
+ fodder for livestock.
605
+ Sowing time: The sowing to be avoided in areas receiving temperature of less than 10C at any of the
606
+ crop growth stages for higher yield of baby corn. It can be sown round the year in India expect
607
+ second fortnight of December to end of January in Northern India.
608
+ Seed and spacing requirement
609
+ Seed rate (kg/acre) Spacing (cm) Plant population (per acre)
610
+ 10 - 12 60*15-20 33,724 to 44,966
611
+ 20
612
+ Intercropping: In general, short duration varieties of intercrops to be preferred for
613
+ intercropping with baby corn. In kharif season, cowpea for green pods and fodder purposes
614
+ and coriander for green leaves can be intercropped with baby corn. Baby corn can be
615
+ intercropped with vegetable crops, viz., spinach, cabbage, cauliflower, coriander, sugar
616
+ beet, radish etc which is particularly suitable in rabi season baby corn. Recommended dose
617
+ of fertilizers of intercrops should be applied in addition to the recommended dose of
618
+ fertilizers of baby corn.
619
+ Fig: Maize based intercropping
620
+ 21
621
+ Fertilizer scheduling: Since baby corn is consumed as vegetable organically grown baby corn has
622
+ market demand both at local and international level. The organic input mentioned for the normal
623
+ kharif maize to be used for organic baby corn production. For higher yield integrated nutrient
624
+ management found beneficial for baby corn and organic sources option mentioned in kharif maize
625
+ to be used along with chemical fertilizer mentioned as below:
626
+ Crop stage Schedule Fertilizer (kg/acre)
627
+ Urea DAP MOP ZnSO.7HO
628
+ 4 2
629
+ Before/at sowing Basal 10 50 40 10
630
+ 4 leaf stage 1st split 26 -- -- --
631
+ 8 leaf stage
632
+ 2nd split 40 -- -- --
633
+ Before detasseling
634
+ After detasseling/ 3rd split 32 -- -- --
635
+ one picking 4th split 20 -- -- --
636
+ Irrigation management: Young seedlings, knee high stage, silking and picking are the most
637
+ sensitive stages for water stress for baby corn and irrigation should be ensured at these stages. Light
638
+ and frequent irrigations are desirable for baby corn.
639
+ Pest Management: As duration of baby corn is short, it experiences lesser extent of pest damage.
640
+ However, as it is consumed fresh pesticides should be applied judiciously, if required.
641
+ Rest management practices for baby corn are similar to normal irrigated maize.
642
+ B.3. Sweet corn
643
+ This crop gets ready for harvesting just 20 days after pollination i.e. within 65-75 days in kharif and
644
+ 80-100 days in rabi season. At high temperature due to conversion of fructose into polysaccharides
645
+ it losses flavor. Due to this reason, sweet corn cultivation should be avoided in spring season. This
646
+ crop needs isolation of at least 400 m from normal maize as pollination deteriorates its quality.
647
+ Generally, 10-15 days isolation in sowing time also ensures quality sweet corn. The cobs should be
648
+ plucked during morning or evening time. Harvested green cobs should be immediately transported
649
+ to the cold storage in refrigerated trucks. The maize plant parts after harvesting of cobs can be
650
+ utilized as excellent green fodder. Intercrops as discussed in baby corn can also be grown with
651
+ sweet corn successfully for higher profitability.
652
+ Sowing time: The sowing to be avoided in areas receiving temperature of less than 10C at any of the
653
+ crop growth stage. At sowing, temperature below 15C may lead to rotten seed. The increase in
654
+ temperature to more than 35C at tasseling i.e. 45-55 days after sowing leads to tassel blast and lesser
655
+ grain setting. Therefore, sweet corn can be sown from June to October and in February in Northern
656
+ India and throughout the year in southern India.
657
+ 22
658
+ Seed and spacing requirement
659
+ Seed rate (kg/acre) Spacing (cm) Plant population (per acre)
660
+ 2.5-3 75x25-30 17,986 to 21,583
661
+ Transplanting: Due to costlier seed and lesser plant population, seedling transplanting is
662
+ beneficial in sweet corn. The seedling should be transplanted when plants are 15-25 cm tall.
663
+ Transplanting is also beneficial for getting early sweet corn in market for fetching higher prices.
664
+ However, there should be adequate moisture at the time of transplanting. To avoid damage by ants
665
+ and other insects the nursery may be treated with furadon or similar granules.
666
+ a b
667
+ Fig: (a) Maize nursery (b) Transplanting of maize seedlings
668
+ Fertilizer scheduling: The organic input mentioned for the normal kharif maize can be used for
669
+ organic sweet corn production. For higher yield, integrated nutrient management found beneficial
670
+ and organic sources option mentioned in kharif maize to be used along with chemical fertilizer
671
+ mentioned as below:
672
+ Crop stage Schedule Fertilizer (kg/acre)
673
+ Urea DAP MOP ZnSO.7HO
674
+ 4 2
675
+ Before/at sowing Basal 45 45 30 10
676
+ 25 DAS 1st split 35 -- -- --
677
+ At flowering 2nd split 20 -- -- --
678
+ 23
679
+ Irrigation management: The most critical period to have adequate moisture is during tasseling
680
+ and silking. Growers should be prepared to irrigate at least 2.5-4.0 cm a week in order to produce
681
+ high quality sweet corn.
682
+ Pest Management: As duration of sweet corn is short and consumed, fresh pesticides should be
683
+ applied judiciously, if required.
684
+ Rest management practices for sweet corn are similar to normal irrigated maize.
685
+ B.4. Maize for green cob
686
+ The cultivation practices are very similar to sweet corn. The cob plucking should be done at 25-35
687
+ days after flowering, when cob colour is still green and kernel are at soft dough stage. The green
688
+ plants are excellent source of fodder. Remaining practices are same as of sweet corn.
689
+ 24
690
+ C. Maize as fodder
691
+ C.1. Maize for green fodder
692
+ Tall, leafy, succulent, late maturing and stay-green type cultivars are desirable for fodder purpose.
693
+ Sowing should be done using normal seed drill. Weeding in generally not required as the high-
694
+ density planting leads to less penetration of sunlight resulting in poor growth of weeds.
695
+ Sowing time: The sowing to be avoided in areas receiving temperature of less than 10C at any of the
696
+ crop growth stages for higher yield of fodder maize. It can be sown round the year in India expect
697
+ second fortnight of December to end of January in Northern India. However, fodder maize is most
698
+ profitable in kharif season, which can be used for silage preparation.
699
+ Seed and spacing requirement
700
+ Seed rate (kg/acre) Spacing (cm) Plant population (per acre)
701
+ 25 30*10 134,898
702
+ Fertilizer scheduling
703
+ Crop stage Schedule Fertilizer (kg/acre)
704
+ Urea DAP MOP ZnSO.7HO
705
+ 4 2
706
+ Before/at sowing Basal 55 55 30 10
707
+ 25-30 DAS 1st split 55 -- -- --
708
+ Harvesting should be done just after flowering (at 60-70 DAS) for better quality fodder. Rest
709
+ agronomic management practices are similar to kharif irrigated maize.
710
+ C.2. Maize for silage making
711
+ All the cultivation practices are similar to kharif/spring sown irrigated maize except harvesting,
712
+ which should be done 25-30 days after flowering (milky to dough stage of grain). Harvesting of
713
+ maize for silage purpose may be done using Fodder Auto-chopper Loader Machine. Silage can be
714
+ prepared easily by silo pack machine. This machine can cut and crash the green fodder, load it in the
715
+ 50 kg air tight plastic bag and compress it. After this process, the bag can be sealed with thread and
716
+ can be stored in open place for ensiling (process of silage making). These 50 kg capacity bags are
717
+ easy to handle and transport.
718
+ 25
719
+ D. Zero till and conservation agriculture based maize cultivation
720
+ Under zero till (ZT) cultivation, planting is to be done in stubble of previous crop without any soil
721
+ disturbance/tillage operation. This saves diesel, tractor's working time and labor and offer timely
722
+ sowing of succeeding crops. Seed and fertilizers should be placed in band using zero-till Seed-cum-
723
+ Fertilizer Planter with furrow opener or happy seeder. Weed management is entirely dependent on
724
+ chemicals as tillage and hand hoeing is prohibited in ZT maize. Destroy the weed before seeding by
725
+ pre-plant application (10-15 days prior to seeding) of non-selective herbicides, viz., paraquat @ 0.2
726
+ kg a.i. per acre in 600 litre water. Under heavy weed infestation, post-emergence application of
727
+ selective herbicides (mentioned earlier) should be done.
728
+ ZT along with surface residue application and diversified crop rotation is known as conservation
729
+ agriculture. Surface residue retention improves soil physical, chemical and biological activities,
730
+ reduces soil erosion & evaporation and also moderate soil temperature. Diversified crop rotation
731
+ break the disease cycle and also improve soil fertility. Zero till planter (under lesser residue load)
732
+ and happy seeder (under heavy residue load) can be used for planting in no-till field.
733
+ Difference in management practices under conventional and conservation agriculture
734
+ Practices Conventional agriculture Conservation agriculture
735
+ Tillage, sowing and Soil is manipulated 4-5 times Soil is disturb to a minimum
736
+ intercultural operation for tillage operation, seeding extent as tillage and inter-
737
+ and intercultural operations. cultural operations are
738
+ completely avoided and
739
+ sowing is done by opening
740
+ narrow furrow just to put seed.
741
+ Cropping system Mono-cropping/less efficient Diversified crop rotations
742
+ rotation
743
+ Residue management Remove/burn Keep on soil surface
744
+ Weed management Hand weeding and/or Herbicide application
745
+ herbicide application
746
+ 26
747
+ Effect of conventional and conservation agriculture based practices
748
+ Particular Conventional agriculture Conservation agriculture
749
+ Fuel consumption More Lesser
750
+ Cost of land preparation More Lesser
751
+ Sowing of succeeding crop Delay Timely
752
+ Soil health Poor Good
753
+ Soil compaction More Lesser
754
+ Water logging More Lesser
755
+ Soil erosion More Less
756
+ a b
757
+ Fig: (a) Zero till planting of maize in mungbean residue; (b) Surface residue retention in maize
758
+ 27
759
+ Recommended maize varieties(released in last 6 years)
760
+ Variety Zone Yield Maturity Season Year of
761
+ (t/ha) (days) release
762
+ Normal maize
763
+ DMRH 1305 NHZ 6.5 Early Kharif 2018
764
+ DMRH-1301 NEPZ, CWZ 9.9 94-96 Rabi 2018
765
+ GAWMH-2 Gujarat - Early Kharif 2018
766
+ DMRH-1308 CWZ 9.6 92-94 Rabi 2018
767
+ Karimnagar Makka PZ 7.9 90-95 Rainfed kharif 2017
768
+ Pant Shankar Makka-4 Uttarakhand 4.6 82-84 Kharif 2017
769
+ Central Maize VL 55 NHZ, PZ 7.6 95-97 Kharif 2017
770
+ PMH-10 Punjab 11.7 175-180 Spring 2016
771
+ Hema Karnataka 5.6 120-125 Spring 2016
772
+ Pratap Makka-9 Rajasthan 4.8 81-87 Kharif, rabi 2016
773
+ Palam Shankar Makka-2 NHZ 9.8 Medium Kharif 2016
774
+ Pratap Hybrid CWZ 5.6 Early Kharif 2016
775
+ Kharif Maize-3
776
+ Karimnagar makka-1 Telangana 9.5 Medium Kharif ,rabi 2016
777
+ PMH-8 Punjab 8.3 112 Spring 2016
778
+ Palam shankar makka-1 CWZ 5.3 Late Kharif 2015
779
+ CoH(M) 10 PZ 7.2 Medium Kharif 2015
780
+ HM-13 NHZ 6.6 Early Kharif 2015
781
+ PMH-6 NEPZ 6.3 Medium Kharif 2015
782
+ CoH(M) 7 NEPZ, PZ 7.8 Late Kharif 2014
783
+ CoH(M) 8 NWPZ, NEPZ, PZ, CWZ 7.1 Medium Kharif 2014
784
+ CoH(M) 9 NEPZ, CWZ 6.4 Medium Kharif 2014
785
+ DHM-121 NEPZ, CWZ 5.4 Medium Kharif 2014
786
+ GH-0727 Karnataka 7.5 Late Kharif 2014
787
+ Vivek Maize Hybrid-47 NHZ 6.9 Early Kharif 2014
788
+ Vivek Maize Hybrid -53 NHZ 6.9 Extra-early Kharif 2014
789
+ Vivek Maize Hybrid -51 CWZ 5.1 Extra early Kharif 2014
790
+ 28
791
+ Variety Zone Yield Maturity Season Year of
792
+ (t/ha) (days) release
793
+ QPM/EDV
794
+ Pusa HM-8 Improved PZ 6.3 90-95 Kharif 2017
795
+ Pusa HM-9 Improved NEPZ 5.2 85-90 2017
796
+ Kharif
797
+ Pusa HM-4 Improved NWPZ, NEPZ 6.4 90-95 Kharif 2017
798
+ Pusa Vivek QPM-9 NHZ, CWZ 5.6 80-85 Kharif 2017
799
+ Improved
800
+ Shaktiman-5 NEPZ 5.5 Medium Kharif & 2018
801
+ & 8.0 Rabi
802
+ Shalimar QPMH-1 J & K 6 135 Kharif 2019
803
+ SWEET CORN
804
+ -
805
+ Shalimar Sweet Corn-1 J & K 90-95 Kharif 2019
806
+ -
807
+ VL Sweet Corn Hybrid-2 NHZ 90-95 Kharif 2019
808
+ 10.8
809
+ Central Maize CL Sweet NHZ, NWPZ 90-95 Kharif 2016
810
+ Corn-1
811
+ BABY CORN
812
+ IMHB1539 NHZ 1.3 Short Kharif 2018
813
+ IMHB1532 NWPZ, CWZ 2.0 Short Kharif 2018
814
+ Vivek Hybrid 27 NHZ, CWZ 2.2 95-97 Kharif 2017
815
+ POPCORN
816
+ DMRHP-1402 NEPZ, CWZ 3.9 75-77 Kharif 2018
817
+ Shalimar Pop Corn-1 NHZ, NWPZ, NEPZ, PZ 3.9 95-100 Kharif 2017
818
+ BPCH-6 NHZ,CWZ, PZ, NEPZ, 3.2 Early Kharif 2015
819
+ NWPZ
820
+ 29
821
+ Notes
822
+ 30
maize_data.txt ADDED
@@ -0,0 +1,822 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Maize Production
2
+ for Food, Feed and Fodder
3
+ S.D. Bamboriya
4
+ Mukesh Choudhary
5
+ Alla Singh
6
+ S.L. Jat
7
+ Sujay Rakshit
8
+ ICAR-Indian Institute of Maize Research, PAU Campus
9
+ Ludhiana, Punjab-141 004 ((India)
10
+ Website: https://iimr.icar.gov.in
11
+ Email: director.maize@icar.gov.in,pdmaize@gmail.com
12
+ Phone: +91-161-2440047-48, Fax: +91 161 2430038
13
+ Citation: S.D. Bamboriya, Mukesh Choudhary, Alla Singh, S.L. Jat and Sujay Rakshit.
14
+ Maize production for food, feed and fodder. IIMR Technical Bulletin
15
+ 2020/2.Indian Institute of Maize Research, PAU Campus, Ludhiana-
16
+ 141004.
17
+ Published in 2020
18
+ Published by:
19
+ ICAR-Indian Institute of Maize Research
20
+ PAU Campus, Ludhiana, Punjab- 141 004 (India)
21
+ Website: https://iimr.icar.gov.in
22
+ Email: director.maize@icar.gov.in,pdmaize@gmail.com
23
+ Phone: +91-161-2440047-48, Fax: +91 161 2430038
24
+ Printed by:
25
+ Azad Offset Printers : # 144, Press Site, Indl. Area-1, Chandigarh
26
+ Tel. : 0172-4611489, 2656144, 2657144
27
+ Email: aop144@gmail.com
28
+ FOREWARD
29
+ Maize (Zea mays L.), the queen of cereals, surpasses all other food crops in its ability to
30
+ adapt to the diverse agro-ecological niches and being cultivated from 58oN to 55oS
31
+ latitude. It is the leading cereal crop in the world with more than one billion tonne
32
+ production. In India, it holds third rank among the cereals, after rice and wheat in terms
33
+ of area and production. Traditionally, maize is grown as a kharif crop in India, but from
34
+ 1970s its expansion started in rabi season and later on in the spring season too. Now,
35
+ the crop is grown round the year and in all agro-ecologies throughout India, not only for
36
+ grain but also for specialized purposes like sweet corn, baby corn and for silage
37
+ making.
38
+ Maize is widely used as food, feed, fodder, industrial raw material and in recent past for
39
+ bio-fuel production. It is a key crop in doubling farmers' income as maize can be
40
+ integrated effectively with dairy, poultry, fisheries and piggery. Speciality corns has a
41
+ special role in value chain development. Considering the changing food habits in India,
42
+ the demand of maize is supposed to increase in the near future. To meet the growing
43
+ demand, there is a need to enhance maize productivity through adoption of the best
44
+ production practices by the maize farmers.
45
+ I am happy to know that ICAR-Indian Institute of Maize Research, Ludhiana is
46
+ bringing out a publication on ''Maize production for food, feed and fodder'' which have
47
+ complete cultivation information for normal and specialty maize right from the sowing
48
+ to harvesting. I congratulate the authors for their contributions in bringing out this
49
+ comprehensive and important publication. I am sure that this publication will be useful
50
+ for researcher, farmers and other stakeholders for enhancing the maize production and
51
+ productivity in the country.
52
+ (T R Sharma)
53
+ E-mail:ddgcs.icar@nic.in Phone:91-11-23382545 Fax:91-11-23097003
54
+ PREFACE
55
+ Declining water resources, degrading soil health, higher production cost, lesser
56
+ profitability and climate change are the major challenge before Indian agriculture.
57
+ Resource use smart crops which can give more profit from lesser resources are need of
58
+ the hour. Maize is one such crop with highest production potential and comparatively
59
+ lesser water foot-prints. It is a multi-purpose crop being used as food, feed, fodder, and
60
+ raw material for various industrial products including bio-fuels.
61
+ Maize is the leading cereal crop in the world with more than one billion tonne
62
+ production and in India it holds third rank after rice and wheat in terms of area and
63
+ production. Traditionally maize in India used to be consumed as food crop. However,
64
+ over time maize has become rather an industrial crop than food crop as over 75% of the
65
+ maize produced in India is used for industrial purchases, mostly as feed and source of
66
+ starches. Being industrial in nature maize can ensure higher remuneration. Further,
67
+ specialty corns, baby corn and sweet corn with short to medium duration cropping
68
+ period can play important role in diversification in peri-urban agricultural systems and
69
+ nutritional garden. They fit well in integrated farming system, where the byproduct of
70
+ specialty corn, i.e. green fodder can support livestock very well. During last 50 years,
71
+ maize productivity has increased from around 0.99 t/ha to 3.1 t/ha but still we are far
72
+ behind leading maize producing nations. Lesser adoption of improved production
73
+ practices is one among the key factors contributing low productivity of Indian maize,
74
+ besides prevalence of rainfed growing condition, limiting effects of various biotic and
75
+ abiotic stresses among others. Improved high yielding cultivars coupled with better
76
+ crop management is bound to increase productivity of maize in India.
77
+ The compiled production practices of various types of maize is expected help to
78
+ researcher, extension workers and farmers in enhancing maize production and
79
+ productivity in the country.
80
+ Authors
81
+ April 2020
82
+ Ludhiana (Punjab)
83
+ Table of Content
84
+ Parts Description Page No.
85
+ Part I Introduction
86
+ Part II Maize for grain purpose
87
+ Irrigated kharif maize
88
+ Rainfed kharif maize
89
+ Irrigated rabi maize
90
+ Irrigated spring maize
91
+ Part III Specialty maize
92
+ Pop corn
93
+ Baby corn
94
+ Sweet corn
95
+ Maize for green cob
96
+ Part IV Maize as fodder
97
+ Green fodder maize
98
+ Silage maize
99
+ Part V Zero till and conservation agriculture based maize
100
+ Part VI Recommended public sector maize varieties
101
+ Maize Production for Food, Feed and Fodder
102
+ Introduction
103
+ Climate change has far serious implications concerning the food and nutritional security of nations
104
+ like India where agriculture is the backbone of nation's economy and growing population is the
105
+ biggest reason to worry. Rural India largely depends on its natural resources and farming for
106
+ earning its livelihood and food security and climate change affects the natural ecosystem
107
+ progressively. In future, it will be even more difficult to predict occurrences of phenomena such as
108
+ droughts, floods, cloud bursts, etc. due to climate change. Consequently, farmers must adapt to the
109
+ changing climate to ensure optimum crop yields and farm income. Farmers in general and small and
110
+ marginal farmers in particular must enhance the resilience of agriculture to face the upcoming
111
+ challenges. Transforming agriculture through adoption of climate resilient practices and
112
+ technologies would be inevitable to stabilize agricultural production and enhance farmer's income.
113
+ Participatory demonstration of location specific and climate smart technologies is
114
+ necessary for enabling farmers to cope climatic variability and extreme weather phenomenon.
115
+ Adoption and spread of these climate resilient technologies would help farmers fetch adaption
116
+ gains and reduce the Green House Gas (GHG) emissions alongside. Considering the urgent need to
117
+ address the issue of climate change at the farm level, Indian Council of Agricultural Research
118
+ (ICAR) launched National Initiatives in Climate Resilient Agriculture (NICRA) in February, 2011,
119
+ which was renamed as National Innovations in Climate Resilient Agriculture (NICRA) to
120
+ emphasize the role of evolving innovations. Resilience is the capability of the production system to
121
+ resist negative impacts of climate change and also the capacity to recover quickly after the damage.
122
+ Therefore, National Innovations in Climate Resilient Agriculture (NICRA) was formulated to
123
+ develop and demonstrate region specific improved technologies that would enhance the resilience
124
+ of Indian agriculture to climate change thereby addressing climate vulnerability and its negative
125
+ impacts. The emphasis on adaptation to climate variability necessitates appropriate responses to
126
+ contingency situations. Considering the need to enhance the resilience of Indian agriculture
127
+ production system to climate variability and climate change, the center theme should be the
128
+ Sustainability of the production systems facing natural resource degradation. Thus, the centre of
129
+ attraction in NICRA is not the enhancement of productivity but the ability of the existing system to
130
+ cope with the vulnerability and to improve the natural resource use efficiency for sustaining the
131
+ productivity gains that have been achieved already. The project aimed to enhance resilience of
132
+ Indian agriculture to climate change and climate variability through its different components
133
+ namely Strategic Research, Technology Demonstration, Capacity Building and
134
+ Sponsored/Competitive Grants.
135
+ 1
136
+ Uses of Maize
137
+ Feed
138
+ Approximately 60% of total maize production in India is used for preparation of concentrated feeds
139
+ for cattle, poultry and piggery as source of energy. Fishery feed also uses maize as an important
140
+ component. The yellow colour of maize is very useful in providing yellow colour to egg yolk and
141
+ yellow tinge to the milk.
142
+ Food
143
+ Grain maize, pop corn, baby corn, sweet corn and green maize cobs are widely used as human food.
144
+ Most commonly used forms are as Chapattis, porridges, corn flakes, boiled or roasted green ears,
145
+ pop corn, baby corn products like salad, vegetable, pickle, pakoda, kheer, laddu and halwa; sweet
146
+ corn products like soup, chat, corn cheese balls, masala corn and salad etc. Around 13% of total
147
+ maize grain production in India is used as food and 7% as processed food, however this does not
148
+ include use of specialty maize, particularly baby corn, sweet corn and green cobs.
149
+ Industrial uses
150
+ Maize acts as a raw material in the manufacture of starch, syrup, dextrose, oil, gelatine etc. Corn
151
+ flour is used as a thickening agent in the preparation of many edibles like soups, sauces and custard
152
+ powder. Corn syrup is used as sweetener in processed foods such as soft drinks and candies. Corn
153
+ sugar (dextrose) is used in pharmaceutical formulations. Maize oil is widely used as a cooking
154
+ medium and it has the quality of reducing cholesterol in the human blood. Maize oil has use in
155
+ cosmetics and pain industry as well. Corn gel because of its moisture retention character is used as a
156
+ bonding agent for ice-cream cones. Maize stalks are made into paper and wall board; husks are used
157
+ as filling material; cobs are used directly for fuel, to make furfurol, fermentable sugars, solvents,
158
+ liquid fuels, charcoal, pulp, paper and hard boards. Approximate 14% of total maize production in
159
+ India is utilised for industrial purposes.
160
+ Bio fuel and bioplastic
161
+ Maize is also used for liquid bio-fuel (ethanol) production in USA. The ethanol is used as
162
+ transportation fuel after blending with gasoline. India is also slowly opening up use of maize grain
163
+ for ethanol production. The maize starch is also used for making biodegradable plastic using poly
164
+ lactic acid (PLA) which will be very useful in the scenario of banning single use of plastic.
165
+ Forage and silage
166
+ Maize stalk is used to feed dairy animals in the form of green fodder, dry roughages andsilage.
167
+ Maize fodder has higher digestibility than any other non-leguminous forage crops and it does not
168
+ contain any toxic substances. Maize is also preferred for silage making over other fodders, as maize
169
+ plant is easy to chaff, requires less labour and its silage is soft.
170
+ 2
171
+ Brief Cultivation Facts
172
+ A. Maize for grain
173
+ A.1. Irrigated kharif maize
174
+ Sowing time: Generally, the ideal sowing time is June 20 to end of July. However, in fields where
175
+ water stagnation may occur, early sowing is desirable so that plant reaches a firm stand to avoid
176
+ lodging associated with water logging.
177
+ Soil: Maize is very sensitive to water-logging and considerable yield losses occur if, the crop faces
178
+ water-stagnation for more than two days. Hence, it is better to plant the crop on well-drained sandy-
179
+ loam to silty-loam soils.
180
+ Land preparation: Maize needs well pulverized and smooth field for quick seed emergence and
181
+ root growth. Hence, two harrowing followed by one planking is needed for field preparation and
182
+ early season weed management. Maize can also be successfully produced under zero-till conditions
183
+ using happy seeder or zero till multi-crop planter.
184
+ a b
185
+ Fig: Land preparation (a) harrowing; (b) land leveling
186
+ Farm-equipments: Mould board plough (MB plough), disc or tine harrow, land-leveler, maize
187
+ planter, narrow bed planter, pneumatic planter, wide bed planter etc.
188
+ 3
189
+ a b
190
+ c d
191
+ Fig: Maize planting equipment (a) Ridge planter; (b) Maize planter;
192
+ (c) Pneumatic planter; (d) Wide bed planter
193
+ Seed rate and seed treatment: Eight kg seed of field corn is needed for seeding in one acre area.
194
+ Seeds should be treated with any of the following fungicides and insecticides before sowing to
195
+ protect the crop from most prevalent (seed and soil borne) diseases and insect-pests.
196
+ 1) Bavistin + Captan in 1:1 ratio@2g/kg seed for Turcicum leaf blight, Banded leaf and sheath
197
+ blight, Maydis leaf blight etc.
198
+ 2) Apran 35 SD@4g/kg seed for Brown stripe downy mildew
199
+ 3) Captan 2.5g/kg for Pythium Stalk Rot
200
+ 4) Imidachlorpid (Gaucho) @ 6 ml/kg or Fipronil @4ml/Kg seed for termite and shoot fly.
201
+ 5) Thiamethoxam + Cyantraniliprole @ 4 ml/kg seed for fall armyworm.
202
+ Any of the above seed treatment may be selected depending upon predominant biotic stresses.
203
+ Sowing method: In kharif sown maize, raised bed planting is recommended to protect the crop
204
+ from water logging. In raised bed planting, 70 cm wide ridges (40 cm ridge and 30 cm furrow) are
205
+ prepared with the help of bed planter. Bed planter with incline plate seed metering system can
206
+ precisely place the maize seed at required depth and does simultaneous operation of raised beds
207
+ making and planting. One line of maize on each raised bed is desirable when sole crop of maize is
208
+ planted keeping seed to seed spacing at 20 cm. Optimum plant density (30,000/acre) should be
209
+ maintained to tap full potentials of hybrids. Southern side planting is advised on East-West oriented
210
+ 4
211
+ ridges. Happy seeder or zero-till bed planters with inclined plate to be used for crop establishment
212
+ under zero tillage or for sowing under crop residue.
213
+ Sowing depth: For proper germination and early vigor, seed should be sown at 3.5-5.0 cm depth.
214
+ Inter cropping: One row of either (a) Cowpea for fodder; (b) Soybean/urdbean/mungbean for
215
+ grain; (c) Groundnut for pods, in between two consecutive rows of maize is desirable for inter-
216
+ cropping with maize. The shade loving crops like turmeric and ginger can also be successfully
217
+ cultivated as intercrop with maize. Herbicides should not be used for weed control in inter-cropping
218
+ system. In case of intercropped maize slightly higher doses of fertilizers should be applied than
219
+ sole crop.
220
+ Irrigation management: Water requirement of maize is 500–800 mm per growing season. During
221
+ kharif season, partially water requirement is met by rainfall. Hence, 1-4 irrigations are required,
222
+ which may vary depending on frequency of rainfall. Adequate moisture at germination, pre-
223
+ tasseling, silking and grain-filling stages should be ensured through irrigation, if rainfall is not
224
+ there. If available, the sprinkler irrigation up to knee length stage is very good for maize crop. In
225
+ ridge-sown crop, irrigation should be given in furrow up to 2/3 of height of the ridge.
226
+ Nutrient management: Hybrid maize is very responsive to nutrient application and has slightly
227
+ high nutrient requirement as compare to other cereals due to high yield potential. It can be grown
228
+ both organically or by integrated nutrient management involving organic and inorganic nutrient
229
+ supplementation.
230
+ Organic nutrient management: Following options for nutrient management in organic maize
231
+ production to be used based on availability in suitable combination
232
+ l Green manuring: Green manuring crops like dhaincha/sunhemp/cowpea at 12/20/20 kg
233
+ seed rate/acre, respectively are very useful. Fifty days old crop is to be ploughed down
234
+ and reserve the field for 10 days for decomposition before sowing of maize.
235
+ l Straw of summer mungbean/cowpea may be buried before sowing of maize
236
+ l Farm yard manure/Compost @ 6 tonnes/acre or vermicompost @ 3 tonnes/acre
237
+ l Application of Azatobacter/Azospirillum with PSB and NPK consortia for seed
238
+ treatment @ 200 g/acre or liquid formulation @ 100 ml/acre.
239
+ Integrated nutrient management: Application of 6 tonnes/acre well decomposed farm yard
240
+ manure/compost mixed with Azatobacter/Azospirillum with PSB, VAM and NPK consortia @ 5-6
241
+ kg/acre or seed treatment with Azatobacter/Azospirillum with PSB and NPK consortia @ 200 g
242
+ each/acre or liquid formulation @ 100 ml/acre needed for better moisture retention and initial boost
243
+ of the crop. Macro- and micro-nutrient requirements of the crop need to be accomplished through
244
+ use of suitable fertilizers. The following schedule of fertilizer may be used:
245
+ 5
246
+ Crop Stage Fertilizers scheduling
247
+ Sowing (Basal) Drill full dose of P, K and 1/3 of N-fertilizer dose, micro-
248
+ nutrient application
249
+ Knee-high (Ist split) Top dress 1/3 N-fertilizer dose and micronutrient spray
250
+ Pre-tasseling (2nd split) Top dressing of remaining 1/3 N-fertilizer dose and micro-
251
+ nutrient spray
252
+ Rate of different fertilizers
253
+ Fertilizer (kg/acre)
254
+ Varieties Sehedule
255
+ Urea DAP MOP ZnSO.7HO
256
+ Long duration Basal 23 52 27 10
257
+ hybrid
258
+ Ist split 44 -- -- --
259
+ 2nd split 44 -- -- --
260
+ Short duration Basal 14 35 20 10
261
+ hybrid, composite Ist split 26 -- -- --
262
+ 2nd split 26 -- -- --
263
+ Maize is sensitive to Zinc deficiency. Zinc deficient crop shows stunted growth and develop short
264
+ inter-nodes. A white (or pale-yellowish) tissue with reddish veins appears on leaf blade. To mitigate
265
+ it 10 kg/acre ZnSO4.7H2O or 6.5 kg/acre ZnSO4.H2O should be applied at sowing. Apply 10-15
266
+ kg Sulphar and 0.5 kg Boron/acre in deficient soils.
267
+ Fig: Zinc deficiency symptoms in maize
268
+ 6
269
+ Weed management: Weeds significantly affect maize production and the critical period for crop-
270
+ weed completion is 15-45 days after sowing.
271
+ Cultural control of weeds: a) Two manual hoeing at 15 and 30 DAS; b) Inter-cropping of one or two
272
+ rows of fodder cowpea in between maize rows reduces weed problem considerably; c) Always use
273
+ weed free seeds for sowing; d) Do not spread un-decomposed compost in field because it may
274
+ contain viable weed seeds; e) Do not allow the seed formation of weeds in fields.
275
+ Chemical control of weeds: Pre-emergence Atrazine application @ 400 g ai/acre followed by one
276
+ hand weeding at 35-40 days gives good weed control. Recommended dose of Atrazine at pre-
277
+ emergence followed by either of the post-emergence herbicide (mentioned below) for effective
278
+ weed control is also equally effective.
279
+ a b
280
+ Fig: (a) Maize field after weeding; (b) Maize field after Tembotrione spray
281
+ 7
282
+ Selective herbicides for maize
283
+ Herbicide Formulations Dose Time of application (DAS)
284
+ (g a.i./acre)
285
+ Atrazine 50% WP 400 0-2 (pre-emergence)
286
+ Topramezone 33.6% SC 10 20-30 (Post emergence)
287
+ Tembotrione 34.4% SC 48 20-30 (Post emergence)
288
+ Precautions:
289
+ l Use flat fan nozzle for herbicide spray.
290
+ l Do not use under/over dose of herbicide.
291
+ l While spraying weedicide sprayed field should not be stepped on, i.e. the farmer should move
292
+ backward or sidewards.
293
+ Saving crop in case of excess water damage: If water logging occurs in the field and damage is
294
+ moderate, 6 kg/acre of urea in two sprays at weekly intervals may be applied. In case of moderate to
295
+ severe damage, 25-50 kg urea/acre after the water flooding is over may be broadcasted.
296
+ a b
297
+ Fig: (a) Water-logged maize field (b) Growth reduction due to water-logging
298
+ Plant Protection
299
+ Major diseases: Maydis Leaf Blight (MLB), Bacterial Leaf and Sheath Blight (BLSB), Charcoal
300
+ Rot (CR), Bacterial Stalk Rot (BSR), Rajasthan Downey Mildew (RDM), Curvularia Leaf Spot
301
+ (CLS), Post Flowering Stalk Rot (PFSR), Brown strip Downey Mildew (BSDM) and Common
302
+ Rust are major diseases of maize.
303
+ 8
304
+ a b c
305
+ d e f
306
+ g h i
307
+ Fig: Maize diseases (a) Maydis leaf blight; (b) Charcoal Rot; (c ) Bacterial stalk rot; (d) Rajasthan
308
+ downey mildew; (e ) Curvularia leaf spot; (f) Bacterial leaf and sheath blight ; (g) Post flowering
309
+ stalk rot; (h) Brown strip downey mildew; (i) Common rust
310
+ 9
311
+ Disease management in maize
312
+ Disease Cultural control Chemical control
313
+ Maydis Deep ploughing of previous A) Seed treatment with Bavistin + Captan
314
+ leaf blight crop residue through in 1:1 ratio @ 2.0 g/kg seed
315
+ B) Spray Dithan Z-78 or Zineb @ 2.4-4
316
+ g/litre water and repeat the spray at 8-
317
+ 10 days interval
318
+ C) Grow MLB resistance varieties, if the
319
+ disease incidence is regular
320
+ Bacterial Stripping of two lower leaves A) Seed treatment with Bavistin + Captan
321
+ leaf and along with leaf sheath in 1:1 ratio @ 2.0 g/kg seed
322
+ sheath B) Spray of Sheethmar (Validamycin) @
323
+ blight A). Deep ploughing, 2.7 ml/litre water
324
+ Charcoal
325
+ B). Crop rotation
326
+ rot
327
+ C). Maintain proper moisture
328
+ during flowering
329
+ Bacterial Stripping of two lower leaves A) Seed treatment with metalaxyl
330
+ stalk rot along with leaf sheath (Ridomil 25 WP, Apron 35 SD) @ 2.5
331
+ Rajasthan g/kg
332
+ A). Field sanitation
333
+ downey B) Foliar spray of metalaxyly (Apron 35
334
+ mildew B). Destroy infected plant FN) @ 2-2.5 g/liter of water at very first
335
+ appearance of disease
336
+ Curvularia A) Spray (Carbendazim 12% + mecozeb
337
+ leaf spot 62.7%) @ 2 g/liter water 35 and 55
338
+ DAS
339
+ B) If zineb is available, then spray Zineb
340
+ 75% @ 2 g/liter at 35 and 55 DAS
341
+ 10
342
+ Disease Cultural control Chemical control
343
+ Post A) Maintain optimum plant - - -
344
+ flowering population
345
+ stalk rot B) Avoid excess N
346
+ C) Follow crop rotation with
347
+ non-host crop like soybean
348
+ D) Manage attack of stem borer
349
+ as their injury predisposes
350
+ to stalk rot
351
+ Brown A) Field sanitation A) Seed treatment with metalaxyl
352
+ strip B) Destroy infected plants (Ridomil 25 WP, Apron 35 SD) @ 2.5
353
+ downey g/kg
354
+ C) Weed control
355
+ mildew B) Foliar spray of metalaxyly (Apron 35
356
+ D) Maintain optimum plant
357
+ FN) @ 2-2.5 g/litre of water at very
358
+ stand
359
+ first appearance of disease
360
+ E) Planting before rainy
361
+ season
362
+ F) Maintain low seed moisture
363
+ (9%) at planting
364
+ Common A) Field sanitation Spray Diathane M-45 @ 2.4-4 g/litre
365
+ rust B) Destroy infected plants water and repeat the spray at 8-10 days
366
+ interval
367
+ C) Weed control
368
+ D) Maintain optimum plant
369
+ stand
370
+ E) Planting before rainy
371
+ season
372
+ F) Maintain low seed moisture
373
+ (9%) at planting
374
+ Major Insect Pests: Maize stem borer, Pink stem borer, Shoot fly and Fall army worm are major
375
+ pest of maize Among these pests, Maize stem borer occurs in kharif, Pink stem borer in rabi and
376
+ Shoot fly in spring season.
377
+ 11
378
+ a b
379
+ c d
380
+ e f
381
+ 12
382
+ a b
383
+ Fig: Mazie pests (a) Maize stem bore; (b) Damage symptoms Maize stem borer; (c ) Fall armyworm
384
+ larvae; (d) Damage symptoms of FAW; (e ) Pink stem borer; (f) Damage symptoms of Pink stem
385
+ bore; (g )Shoot fly; (h) Damage symptoms of Shoot fly
386
+ Management of maize pests
387
+ Pest Cultural control Chemical control Biological control
388
+ Maize Stem Grow cowpea in Spray the crop with Use Trichocards
389
+ Borer (Kharif between maize rows chemicals like (Trichogrammachilonis)
390
+ season pest) and as intercrop against Chlorantraniliprole on 15 days old crop @ 3
391
+ Pink stem borer Maize stem borer. 18.5% SC @ 60 ml cards per acre
392
+ (rabi season pest) per acre at 15-18 DAS
393
+ Border planting of Place a pinch of
394
+ sorghum (3-4 rows) Carbofuran 3% G in
395
+ around maize crop whorl of infested
396
+ against Maize stem maize plant at initial
397
+ borer. stage of infestation
398
+ 13
399
+ Pest Cultural control Chemical control Biological control
400
+ Fall Army Worm Choose cultivars Whorl application of Whorl application of
401
+ with tough husk either of pesticide either of biological
402
+ cover formulations at 15-25
403
+ days after sowing
404
+ Border planting of A) Spinetoram11.7% A) 5% NSKE or
405
+ sorghum (3-4 rows) SC @ 0.5ml/l azadirachtin 1500
406
+ around maize crop ppm @ 5 ml/litre
407
+ against Maize stem B) Thiamethoxam B) Metarhizium
408
+ borer. 12.5% + Lambda anisopliae talc
409
+ Cyhalothrin 9.5% formulation (1x108
410
+ ZC @ 0.25 ml/l cfu/g) @ 5g/litre
411
+ C ) C) Nomuraea rileyi rice
412
+ Chlorantraniliprol grain formulation
413
+ e 18.5% SC @ 0.4 (1x108 cfu/g) @
414
+ ml/l 3g/litre
415
+ D) Btk formulation @
416
+ D) E m a m e c t i n 2ml/l of water
417
+ benzoate 5 SG @
418
+ 0.4 g/l
419
+ Intercropping with -- Release of Tricho-
420
+ pulses and other gramma pretiosum @
421
+ non-host crop 50000 Or Telenomus
422
+ remus @ 10,000 per
423
+ acre at weekly intervals
424
+ Shoot fly Early planting in A) Seed treatment --
425
+ (spring) first week of with Imidacloprid
426
+ February 600 FS (Gaucho)
427
+ @ 6 m l / k g o r
428
+ Thiomethoxam 30
429
+ FS @ 8ml/kg seed.
430
+ B) Soil application of
431
+ Furadan (Carbo-
432
+ furan3G) @ 8-10
433
+ kg per acre in the
434
+ furrow during
435
+ sowing is also
436
+ helpful agains
437
+ 14
438
+ Application of nitrogen and irrigation after control measures helps in faster recovery from pest
439
+ damage.
440
+ Bird management: Nearly ten bird species feed and damage maize cobs. The yield loss due to bird
441
+ feeding is huge and ranges between 10 to 40% in the case of maize crop. To reduce the damage by
442
+ Parakeets and crows, cover maize cobs by wrapping adjacent green leaves around them on outer
443
+ four rows of the field. Acoustic devices also available in market which keep away depredatory birds
444
+ from fields by producing recorded sounds. These devices produce natural sound of bird predators
445
+ and alarm call of pest birds. Thus, the pest birds avoid the broadcast area. Beside this, reflective
446
+ ribbons also scare birds through reflection of sunlight and humming noise produced by the wind.
447
+ Harvesting and shelling: Maize can be harvested when the husk has dried and turned brown. Apart
448
+ from hand-picking, combined harvester may also be used for quick harvesting. After manual
449
+ harvesting, depending upon the cultivated area, manual shellers or maize dehusker-cum-sheller or
450
+ maize thresher may be used for separating grains from cobs.
451
+ Fig: Combine harvesting in maize
452
+ Grain drying: During harvesting of maize, grain moisture content is quite high (~30-35%). Due to
453
+ higher moisture content farmers cannot get good price of their produce. Beside this, storage at high
454
+ grain moisture creates problems of fungal infection and can cause heating and loss of germination.
455
+ Hence, after crop harvesting, produce drying is very much essential. Portable Maize Dryer can be
456
+ used for reducing the moisture content of the cobs. It is tractor or electricity driven, portable and
457
+ long lasting dryer. It can dry any type of grain and do not need pre-cleaning of grains. Its drying rate
458
+ ranges between 2-10 t/h depending on crop type, grain moisture content etc. The optimum moisture
459
+ in grain for long-term storage should be below 14%. Sun drying of the cobs and seeds is required in
460
+ absence of other drying options prior to marketing as moisture above optimum level reduces market
461
+ prices and increases chance of aflatoxin contamination.
462
+ 15
463
+ Fig: Mobile batch dryer
464
+ Grain storage: Large scale kharif maize harvesting during October-November and rabi maize in
465
+ April-May months, result in price drop. Hence, to fetch better price, farmers generally store their
466
+ produce for higher profitability. But, the higher atmospheric humidity, cloudy weather and higher
467
+ grain moisture content leads to fungal infection and physical deterioration of maize grain. Hence,
468
+ proper drying followed by moisture proof storage are very much needed for long term storage of
469
+ maize grains. Pusa bin and metal bin are some cost-effective and moisture proof storage structures
470
+ which can be used by maize farmers. Pusa bin is modification of ordinary mud storage structure. It
471
+ is rectangular in shape and constructed of bricks and earth. To make it moisture proof, a plastic film
472
+ (700 gauge) is used all around ((inner side) of bin. It can store up to 3 tonnes of well dried grains for
473
+ longer period with minimum loss. Metal bin is moisture proof storage structure and made of steel or
474
+ aluminium. The bin is durable and also commercially available. Its storage capacity ranges from 1
475
+ to 10tonnes. Hermatic cocoons are another storage container having two plastic half-joined
476
+ together with a air tight zip. It is made up of thin and ultra low permeable plastic with 500 times
477
+ lesser permeability to oxygen than normal plastic. The air tight container prevent development of
478
+ storage pest as it block respiration of pest (due to low oxygen). It does not allow moisture
479
+ movement hence also prevent aflatoxin problem.
480
+ Store grain pest management: Rice weevil and Angoumois grain moth are major pest of maize
481
+ during storage. Following point should keep in mind during storage.
482
+ l The moisture content of grain should be less than 12%.
483
+ l Clean the storage bins before using them for storage.
484
+ l Newer grains should not be mixed with older ones.
485
+ l Staggered sun drying with short exposure to sun spread reduces insect infestation.
486
+ 16
487
+ l Use of plant products such as Adathoda vasica, Azadirachta indica, Vitex negundo,
488
+ Catharanthus roseus @ 2% w/w (20g /kg seed) have been found to be effective against storage
489
+ pests.
490
+ A.2. Rainfed kharif maize
491
+ Sowing time: In rainfed regions sowing time is rain dependent and should be done just after
492
+ monsoon occurance in end of June to second fortnight of July.
493
+ Seed rate and spacing requirement in rainfed maize
494
+ Seed rate (kg/acre) Spacing (cm) Plant population (per acre)
495
+ 7-8 70 x 20 -25 23,134 to 28,918
496
+ Fertilizer scheduling: Organic nutrient supplementation to be given and inorganic N fertilizers is
497
+ to be splitted into two doses, at basal and depending on moisture availability between knee high to
498
+ tasseling stage.
499
+ Rate of different fertilizers needed for rainfed maize crop
500
+ Fertilizer (kg/acre)
501
+ Soil Type Schedule
502
+ Urea DAP ZnSO4.7H2O
503
+ Sandy loam to clay loam Basal 46 35 10
504
+ soil with adequate 1st split
505
+ moisture stored 24 -- --
506
+ Loamy sand to sandy Basal
507
+ 35 18 --
508
+ soils with low moisture
509
+ 1st split
510
+ stored
511
+ -- -- --
512
+ Soil moisture conservation: For rainfed crops, soil moisture is the most limiting factor. Hence,
513
+ moisture conservation practices are required to be followed to attain maximum yield.
514
+ 17
515
+ Soil moisture conservation practice.
516
+ l Plough the field against slope after pre-monsoon showers to enhance water
517
+ absorption/filtration
518
+ l Sowing and other operations should be carried out on contour/across the slope
519
+ l Spread locally available mulching material in the last week of August
520
+ l Application of the farm yard manure/compost @ 5-6 tonnes/acre
521
+ Rest agronomic practices are same as discussed earlier.
522
+ A.3. Rabi maize
523
+ Sowing time: 15th October to 15th November is the best time, however this may vary for region to
524
+ region.
525
+ Sowing method: Before sowing, seed should be soaked overnight in warm (45oC at the time of seed
526
+ soaking) water. This treatment helps in obtaining better plant stand and healthy crop. Sowing
527
+ should be done on the southern side of the east-west ridge so that the optimum amount of sunshine is
528
+ received and the seedbed remains warm.
529
+ Seed rate and spacing requirement in rabi maize
530
+ Seed rate (kg/acre) Spacing (cm) Plant population (per acre)
531
+ 20-22 60 x 20 33,333
532
+ Intercropping: During the rabi season potato, table pea, onion, garlic, coriander, spinach,
533
+ coriander, beetroot, cabbage etc. can be grown in between maize rows to ensure higher income of
534
+ growers without harming the yield of winter maize.
535
+ Fertilizer scheduling: The following fertilizer schedule should be used to get higher yield.
536
+ Crop stage Schedule Fertilizer (kg/acre)
537
+ Urea DAP MOP ZnSO.7HO
538
+ 4 2
539
+ Before at sowing Basal
540
+ 26 70 40 10
541
+ 4 leaf stage 1st split 26 - - -
542
+ 8 leaf stage 2nd split 40 - - -
543
+ Tasseling stage 3rd split 26 - - -
544
+ Grain filling stage 4th split 6 - - -
545
+ 18
546
+ Irrigation management: Four to six irrigations are needed for rabi season crop. If six irrigations
547
+ are given, they should be applied as two before flowering, one at the time of flowering, two after
548
+ flowering and one at the early grain-filling stage. If only five irrigations are given, one irrigation at
549
+ the vegetative stage may be avoided; and if only four irrigations are given, irrigation after the dough
550
+ stage may be avoided. The irrigation should, however be changed suitably if adequate rains are
551
+ received. Rest management practices are similar to irrigated maize.
552
+ A.4. Spring maize
553
+ Sowing time: January 20 – February 20 is ideal sowing time for spring maize planting.
554
+ Sowing method: Evaporative losses of water during spring season from the soil under flat as well
555
+ as raised bed planting is higher and hence crop suffers from moisture stress. Under such conditions,
556
+ it is always advisable to grow maize in furrows for proper growth, seed setting and higher
557
+ productivity. Zero-till planning is beneficial in spring maize after harvesting of potato, mustard etc.
558
+ Irrigation: Spring maize needs nearly 10-15 irrigations sometimes even higher as the evapo-
559
+ transpiration demand is quite higher in summer season. Hence, a water use-efficient irrigation
560
+ system i.e. drip method is desirable under spring sown maize. Apply first irrigation at 25-30 DAS.
561
+ Under non-drip irrigation, apply irrigation at 2 weeks interval upto10th April and on per week basis
562
+ after this, up to maturity. From water conservation point of view spring maize without drip
563
+ irrigation is not recommended.
564
+ Fertilizer scheduling: For higher yield, integrated nutrient management found beneficial for
565
+ spring maize and organic sources option mentioned in kharif maize to be used along with chemical
566
+ fertilizer mentioned as below:
567
+ Rate of different fertilizers needed
568
+ Varieties Schedule Fertilizer (kg/acre)
569
+ Urea DAP MOP ZnSO.7HO
570
+ 4 2
571
+ Medium duration Basal 33 55 27 10
572
+ hybrid 1st split 33 -- --
573
+ 2nd split 33 -- --
574
+ Medium duration Basal 25 27 27
575
+ hybrid 1st split 25 -- --
576
+ 2nd split 25 -- --
577
+ Rest management practices are similar to irrigated kharif maize for grain purpose.
578
+ 19
579
+ B. Specialty corn/special purpose maize
580
+ B.1. Pop corn
581
+ Pop corn cultivation practices are similar to grain purpose as discussed earlier except the pop corn
582
+ cultivars are shorter of duration (80-90 days). However, as a premier crop preferably to be grown
583
+ under irrigated conditions. This crop needs isolation of at least 400 m from normal maize as
584
+ pollination with normal maize deteriorates its popping quality. Generally, 10-15 days isolation in
585
+ sowing time also ensures quality pop corn. As the plant type of the pop corn is weak and affected
586
+ more by diseases and pest and thus should be preferably to be grown in mild climate i.e. winter
587
+ season/hilly areas for better yield and quality.
588
+ Seed and spacing requirement Seed and spacing requirement
589
+ Seed rate (kg/acre) Spacing (cm) Plant population (per acre) Seed rate (kg/acre) Spacing (cm) Plant population (per acre)
590
+ 4 - 5 60 x 20 33,724 4 - 5 60 x 20 33,724
591
+ Rest management practices are similar to irrigated maize for grain purpose.
592
+ B.2. Baby corn
593
+ It is shortest duration maize crop and gets ready for harvesting within two months of planting and
594
+ harvested in 60-70 days during kharif and 80-100 days in rabi season. This crop needs isolation of at
595
+ least 400 m from normal maize as pollination deteriorates its quality. Generally, 10-15 days
596
+ isolation in sowing time also ensures quality baby corn. Detasseling is needed in baby corn for
597
+ quality assurance. It is done by removing the tassel of the plant as soon as it emerges from the flag
598
+ leaf. It should be practiced row-wise. While detasseling, leaf should not be removed which will
599
+ otherwise affect net photosynthesis and ultimately reduce average baby corn yield. However, this is
600
+ not needed when male sterile baby corn cultivars are chosen for cultivation. Harvesting should be
601
+ done in morning or evening and stored under cool conditions in shed. After dehusking cobs should
602
+ preferably kept under wrap and refrigerated. The crop should be harvested after 1-3 days of silk
603
+ emergence. The remaining plant portion (tassels, main stem, husks) serves as nutritious green
604
+ fodder for livestock.
605
+ Sowing time: The sowing to be avoided in areas receiving temperature of less than 10C at any of the
606
+ crop growth stages for higher yield of baby corn. It can be sown round the year in India expect
607
+ second fortnight of December to end of January in Northern India.
608
+ Seed and spacing requirement
609
+ Seed rate (kg/acre) Spacing (cm) Plant population (per acre)
610
+ 10 - 12 60*15-20 33,724 to 44,966
611
+ 20
612
+ Intercropping: In general, short duration varieties of intercrops to be preferred for
613
+ intercropping with baby corn. In kharif season, cowpea for green pods and fodder purposes
614
+ and coriander for green leaves can be intercropped with baby corn. Baby corn can be
615
+ intercropped with vegetable crops, viz., spinach, cabbage, cauliflower, coriander, sugar
616
+ beet, radish etc which is particularly suitable in rabi season baby corn. Recommended dose
617
+ of fertilizers of intercrops should be applied in addition to the recommended dose of
618
+ fertilizers of baby corn.
619
+ Fig: Maize based intercropping
620
+ 21
621
+ Fertilizer scheduling: Since baby corn is consumed as vegetable organically grown baby corn has
622
+ market demand both at local and international level. The organic input mentioned for the normal
623
+ kharif maize to be used for organic baby corn production. For higher yield integrated nutrient
624
+ management found beneficial for baby corn and organic sources option mentioned in kharif maize
625
+ to be used along with chemical fertilizer mentioned as below:
626
+ Crop stage Schedule Fertilizer (kg/acre)
627
+ Urea DAP MOP ZnSO.7HO
628
+ 4 2
629
+ Before/at sowing Basal 10 50 40 10
630
+ 4 leaf stage 1st split 26 -- -- --
631
+ 8 leaf stage
632
+ 2nd split 40 -- -- --
633
+ Before detasseling
634
+ After detasseling/ 3rd split 32 -- -- --
635
+ one picking 4th split 20 -- -- --
636
+ Irrigation management: Young seedlings, knee high stage, silking and picking are the most
637
+ sensitive stages for water stress for baby corn and irrigation should be ensured at these stages. Light
638
+ and frequent irrigations are desirable for baby corn.
639
+ Pest Management: As duration of baby corn is short, it experiences lesser extent of pest damage.
640
+ However, as it is consumed fresh pesticides should be applied judiciously, if required.
641
+ Rest management practices for baby corn are similar to normal irrigated maize.
642
+ B.3. Sweet corn
643
+ This crop gets ready for harvesting just 20 days after pollination i.e. within 65-75 days in kharif and
644
+ 80-100 days in rabi season. At high temperature due to conversion of fructose into polysaccharides
645
+ it losses flavor. Due to this reason, sweet corn cultivation should be avoided in spring season. This
646
+ crop needs isolation of at least 400 m from normal maize as pollination deteriorates its quality.
647
+ Generally, 10-15 days isolation in sowing time also ensures quality sweet corn. The cobs should be
648
+ plucked during morning or evening time. Harvested green cobs should be immediately transported
649
+ to the cold storage in refrigerated trucks. The maize plant parts after harvesting of cobs can be
650
+ utilized as excellent green fodder. Intercrops as discussed in baby corn can also be grown with
651
+ sweet corn successfully for higher profitability.
652
+ Sowing time: The sowing to be avoided in areas receiving temperature of less than 10C at any of the
653
+ crop growth stage. At sowing, temperature below 15C may lead to rotten seed. The increase in
654
+ temperature to more than 35C at tasseling i.e. 45-55 days after sowing leads to tassel blast and lesser
655
+ grain setting. Therefore, sweet corn can be sown from June to October and in February in Northern
656
+ India and throughout the year in southern India.
657
+ 22
658
+ Seed and spacing requirement
659
+ Seed rate (kg/acre) Spacing (cm) Plant population (per acre)
660
+ 2.5-3 75x25-30 17,986 to 21,583
661
+ Transplanting: Due to costlier seed and lesser plant population, seedling transplanting is
662
+ beneficial in sweet corn. The seedling should be transplanted when plants are 15-25 cm tall.
663
+ Transplanting is also beneficial for getting early sweet corn in market for fetching higher prices.
664
+ However, there should be adequate moisture at the time of transplanting. To avoid damage by ants
665
+ and other insects the nursery may be treated with furadon or similar granules.
666
+ a b
667
+ Fig: (a) Maize nursery (b) Transplanting of maize seedlings
668
+ Fertilizer scheduling: The organic input mentioned for the normal kharif maize can be used for
669
+ organic sweet corn production. For higher yield, integrated nutrient management found beneficial
670
+ and organic sources option mentioned in kharif maize to be used along with chemical fertilizer
671
+ mentioned as below:
672
+ Crop stage Schedule Fertilizer (kg/acre)
673
+ Urea DAP MOP ZnSO.7HO
674
+ 4 2
675
+ Before/at sowing Basal 45 45 30 10
676
+ 25 DAS 1st split 35 -- -- --
677
+ At flowering 2nd split 20 -- -- --
678
+ 23
679
+ Irrigation management: The most critical period to have adequate moisture is during tasseling
680
+ and silking. Growers should be prepared to irrigate at least 2.5-4.0 cm a week in order to produce
681
+ high quality sweet corn.
682
+ Pest Management: As duration of sweet corn is short and consumed, fresh pesticides should be
683
+ applied judiciously, if required.
684
+ Rest management practices for sweet corn are similar to normal irrigated maize.
685
+ B.4. Maize for green cob
686
+ The cultivation practices are very similar to sweet corn. The cob plucking should be done at 25-35
687
+ days after flowering, when cob colour is still green and kernel are at soft dough stage. The green
688
+ plants are excellent source of fodder. Remaining practices are same as of sweet corn.
689
+ 24
690
+ C. Maize as fodder
691
+ C.1. Maize for green fodder
692
+ Tall, leafy, succulent, late maturing and stay-green type cultivars are desirable for fodder purpose.
693
+ Sowing should be done using normal seed drill. Weeding in generally not required as the high-
694
+ density planting leads to less penetration of sunlight resulting in poor growth of weeds.
695
+ Sowing time: The sowing to be avoided in areas receiving temperature of less than 10C at any of the
696
+ crop growth stages for higher yield of fodder maize. It can be sown round the year in India expect
697
+ second fortnight of December to end of January in Northern India. However, fodder maize is most
698
+ profitable in kharif season, which can be used for silage preparation.
699
+ Seed and spacing requirement
700
+ Seed rate (kg/acre) Spacing (cm) Plant population (per acre)
701
+ 25 30*10 134,898
702
+ Fertilizer scheduling
703
+ Crop stage Schedule Fertilizer (kg/acre)
704
+ Urea DAP MOP ZnSO.7HO
705
+ 4 2
706
+ Before/at sowing Basal 55 55 30 10
707
+ 25-30 DAS 1st split 55 -- -- --
708
+ Harvesting should be done just after flowering (at 60-70 DAS) for better quality fodder. Rest
709
+ agronomic management practices are similar to kharif irrigated maize.
710
+ C.2. Maize for silage making
711
+ All the cultivation practices are similar to kharif/spring sown irrigated maize except harvesting,
712
+ which should be done 25-30 days after flowering (milky to dough stage of grain). Harvesting of
713
+ maize for silage purpose may be done using Fodder Auto-chopper Loader Machine. Silage can be
714
+ prepared easily by silo pack machine. This machine can cut and crash the green fodder, load it in the
715
+ 50 kg air tight plastic bag and compress it. After this process, the bag can be sealed with thread and
716
+ can be stored in open place for ensiling (process of silage making). These 50 kg capacity bags are
717
+ easy to handle and transport.
718
+ 25
719
+ D. Zero till and conservation agriculture based maize cultivation
720
+ Under zero till (ZT) cultivation, planting is to be done in stubble of previous crop without any soil
721
+ disturbance/tillage operation. This saves diesel, tractor's working time and labor and offer timely
722
+ sowing of succeeding crops. Seed and fertilizers should be placed in band using zero-till Seed-cum-
723
+ Fertilizer Planter with furrow opener or happy seeder. Weed management is entirely dependent on
724
+ chemicals as tillage and hand hoeing is prohibited in ZT maize. Destroy the weed before seeding by
725
+ pre-plant application (10-15 days prior to seeding) of non-selective herbicides, viz., paraquat @ 0.2
726
+ kg a.i. per acre in 600 litre water. Under heavy weed infestation, post-emergence application of
727
+ selective herbicides (mentioned earlier) should be done.
728
+ ZT along with surface residue application and diversified crop rotation is known as conservation
729
+ agriculture. Surface residue retention improves soil physical, chemical and biological activities,
730
+ reduces soil erosion & evaporation and also moderate soil temperature. Diversified crop rotation
731
+ break the disease cycle and also improve soil fertility. Zero till planter (under lesser residue load)
732
+ and happy seeder (under heavy residue load) can be used for planting in no-till field.
733
+ Difference in management practices under conventional and conservation agriculture
734
+ Practices Conventional agriculture Conservation agriculture
735
+ Tillage, sowing and Soil is manipulated 4-5 times Soil is disturb to a minimum
736
+ intercultural operation for tillage operation, seeding extent as tillage and inter-
737
+ and intercultural operations. cultural operations are
738
+ completely avoided and
739
+ sowing is done by opening
740
+ narrow furrow just to put seed.
741
+ Cropping system Mono-cropping/less efficient Diversified crop rotations
742
+ rotation
743
+ Residue management Remove/burn Keep on soil surface
744
+ Weed management Hand weeding and/or Herbicide application
745
+ herbicide application
746
+ 26
747
+ Effect of conventional and conservation agriculture based practices
748
+ Particular Conventional agriculture Conservation agriculture
749
+ Fuel consumption More Lesser
750
+ Cost of land preparation More Lesser
751
+ Sowing of succeeding crop Delay Timely
752
+ Soil health Poor Good
753
+ Soil compaction More Lesser
754
+ Water logging More Lesser
755
+ Soil erosion More Less
756
+ a b
757
+ Fig: (a) Zero till planting of maize in mungbean residue; (b) Surface residue retention in maize
758
+ 27
759
+ Recommended maize varieties(released in last 6 years)
760
+ Variety Zone Yield Maturity Season Year of
761
+ (t/ha) (days) release
762
+ Normal maize
763
+ DMRH 1305 NHZ 6.5 Early Kharif 2018
764
+ DMRH-1301 NEPZ, CWZ 9.9 94-96 Rabi 2018
765
+ GAWMH-2 Gujarat - Early Kharif 2018
766
+ DMRH-1308 CWZ 9.6 92-94 Rabi 2018
767
+ Karimnagar Makka PZ 7.9 90-95 Rainfed kharif 2017
768
+ Pant Shankar Makka-4 Uttarakhand 4.6 82-84 Kharif 2017
769
+ Central Maize VL 55 NHZ, PZ 7.6 95-97 Kharif 2017
770
+ PMH-10 Punjab 11.7 175-180 Spring 2016
771
+ Hema Karnataka 5.6 120-125 Spring 2016
772
+ Pratap Makka-9 Rajasthan 4.8 81-87 Kharif, rabi 2016
773
+ Palam Shankar Makka-2 NHZ 9.8 Medium Kharif 2016
774
+ Pratap Hybrid CWZ 5.6 Early Kharif 2016
775
+ Kharif Maize-3
776
+ Karimnagar makka-1 Telangana 9.5 Medium Kharif ,rabi 2016
777
+ PMH-8 Punjab 8.3 112 Spring 2016
778
+ Palam shankar makka-1 CWZ 5.3 Late Kharif 2015
779
+ CoH(M) 10 PZ 7.2 Medium Kharif 2015
780
+ HM-13 NHZ 6.6 Early Kharif 2015
781
+ PMH-6 NEPZ 6.3 Medium Kharif 2015
782
+ CoH(M) 7 NEPZ, PZ 7.8 Late Kharif 2014
783
+ CoH(M) 8 NWPZ, NEPZ, PZ, CWZ 7.1 Medium Kharif 2014
784
+ CoH(M) 9 NEPZ, CWZ 6.4 Medium Kharif 2014
785
+ DHM-121 NEPZ, CWZ 5.4 Medium Kharif 2014
786
+ GH-0727 Karnataka 7.5 Late Kharif 2014
787
+ Vivek Maize Hybrid-47 NHZ 6.9 Early Kharif 2014
788
+ Vivek Maize Hybrid -53 NHZ 6.9 Extra-early Kharif 2014
789
+ Vivek Maize Hybrid -51 CWZ 5.1 Extra early Kharif 2014
790
+ 28
791
+ Variety Zone Yield Maturity Season Year of
792
+ (t/ha) (days) release
793
+ QPM/EDV
794
+ Pusa HM-8 Improved PZ 6.3 90-95 Kharif 2017
795
+ Pusa HM-9 Improved NEPZ 5.2 85-90 2017
796
+ Kharif
797
+ Pusa HM-4 Improved NWPZ, NEPZ 6.4 90-95 Kharif 2017
798
+ Pusa Vivek QPM-9 NHZ, CWZ 5.6 80-85 Kharif 2017
799
+ Improved
800
+ Shaktiman-5 NEPZ 5.5 Medium Kharif & 2018
801
+ & 8.0 Rabi
802
+ Shalimar QPMH-1 J & K 6 135 Kharif 2019
803
+ SWEET CORN
804
+ -
805
+ Shalimar Sweet Corn-1 J & K 90-95 Kharif 2019
806
+ -
807
+ VL Sweet Corn Hybrid-2 NHZ 90-95 Kharif 2019
808
+ 10.8
809
+ Central Maize CL Sweet NHZ, NWPZ 90-95 Kharif 2016
810
+ Corn-1
811
+ BABY CORN
812
+ IMHB1539 NHZ 1.3 Short Kharif 2018
813
+ IMHB1532 NWPZ, CWZ 2.0 Short Kharif 2018
814
+ Vivek Hybrid 27 NHZ, CWZ 2.2 95-97 Kharif 2017
815
+ POPCORN
816
+ DMRHP-1402 NEPZ, CWZ 3.9 75-77 Kharif 2018
817
+ Shalimar Pop Corn-1 NHZ, NWPZ, NEPZ, PZ 3.9 95-100 Kharif 2017
818
+ BPCH-6 NHZ,CWZ, PZ, NEPZ, 3.2 Early Kharif 2015
819
+ NWPZ
820
+ 29
821
+ Notes
822
+ 30
requirements.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ fastapi==0.104.1
2
+ uvicorn[standard]==0.24.0
3
+ python-multipart==0.0.6
4
+ aiofiles==23.2.1
5
+ langchain==0.1.0
6
+ langchain-community==0.1.0
7
+ langchain-google-genai==0.0.6
8
+ google-generativeai==0.3.2
9
+ faiss-cpu==1.7.4
10
+ tiktoken==0.5.2
11
+ pydantic==2.5.0
12
+ python-dotenv==1.0.0
static/index.html ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Maize Crop RAG System</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ </head>
9
+ <body>
10
+ <div class="container">
11
+ <header>
12
+ <h1>🌽 Maize Crop Intelligence System</h1>
13
+ <p>AI-powered Q&A for Maize Agriculture</p>
14
+ </header>
15
+
16
+ <div class="status-bar" id="statusBar">
17
+ <span class="status-indicator" id="statusIndicator"></span>
18
+ <span id="statusText">Checking system status...</span>
19
+ <button id="statsBtn" class="stats-btn">📊 Token Stats</button>
20
+ </div>
21
+
22
+ <div class="init-section" id="initSection" style="display: none;">
23
+ <h3>Initialize System</h3>
24
+ <input type="password" id="apiKeyInput" placeholder="Enter Google API Key">
25
+ <button id="initBtn">Initialize</button>
26
+ </div>
27
+
28
+ <div class="main-content" id="mainContent" style="display: none;">
29
+ <div class="query-section">
30
+ <h3>Ask About Maize</h3>
31
+ <div class="input-group">
32
+ <textarea id="queryInput" placeholder="Ask your question about maize cultivation, pests, irrigation, soil, etc." rows="3"></textarea>
33
+ <button id="submitBtn">Ask Question</button>
34
+ </div>
35
+
36
+ <div class="sample-queries">
37
+ <p>Sample questions:</p>
38
+ <button class="sample-btn" data-query="What are the main pests affecting maize crops?">Pests</button>
39
+ <button class="sample-btn" data-query="How should maize be irrigated?">Irrigation</button>
40
+ <button class="sample-btn" data-query="What is the ideal soil type for maize?">Soil</button>
41
+ <button class="sample-btn" data-query="What is the typical yield per acre?">Yield</button>
42
+ </div>
43
+ </div>
44
+
45
+ <div class="results-section" id="resultsSection" style="display: none;">
46
+ <h3>Answer</h3>
47
+ <div id="answerContent" class="answer-content"></div>
48
+
49
+ <div class="metadata">
50
+ <div id="tokenInfo" class="token-info"></div>
51
+ <div id="timeInfo" class="time-info"></div>
52
+ </div>
53
+
54
+ <div id="sourcesSection" class="sources-section" style="display: none;">
55
+ <h4>Sources</h4>
56
+ <div id="sourcesList"></div>
57
+ </div>
58
+ </div>
59
+
60
+ <div class="upload-section">
61
+ <h3>Upload New Document</h3>
62
+ <input type="file" id="fileInput" accept=".txt">
63
+ <button id="uploadBtn">Upload & Reinitialize</button>
64
+ </div>
65
+ </div>
66
+
67
+ <div class="loading" id="loading" style="display: none;">
68
+ <div class="spinner"></div>
69
+ <p>Processing your query...</p>
70
+ </div>
71
+
72
+ <div class="stats-modal" id="statsModal" style="display: none;">
73
+ <div class="modal-content">
74
+ <span class="close">&times;</span>
75
+ <h3>Token Usage Statistics</h3>
76
+ <div id="statsContent"></div>
77
+ </div>
78
+ </div>
79
+ </div>
80
+
81
+ <script src="script.js"></script>
82
+ </body>
83
+ </html>
static/script.js ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const API_BASE = 'http://localhost:7860';
2
+
3
+ // DOM Elements
4
+ const statusBar = document.getElementById('statusBar');
5
+ const statusIndicator = document.getElementById('statusIndicator');
6
+ const statusText = document.getElementById('statusText');
7
+ const initSection = document.getElementById('initSection');
8
+ const mainContent = document.getElementById('mainContent');
9
+ const queryInput = document.getElementById('queryInput');
10
+ const submitBtn = document.getElementById('submitBtn');
11
+ const resultsSection = document.getElementById('resultsSection');
12
+ const answerContent = document.getElementById('answerContent');
13
+ const tokenInfo = document.getElementById('tokenInfo');
14
+ const timeInfo = document.getElementById('timeInfo');
15
+ const sourcesSection = document.getElementById('sourcesSection');
16
+ const sourcesList = document.getElementById('sourcesList');
17
+ const loading = document.getElementById('loading');
18
+ const statsBtn = document.getElementById('statsBtn');
19
+ const statsModal = document.getElementById('statsModal');
20
+ const statsContent = document.getElementById('statsContent');
21
+ const apiKeyInput = document.getElementById('apiKeyInput');
22
+ const initBtn = document.getElementById('initBtn');
23
+ const fileInput = document.getElementById('fileInput');
24
+ const uploadBtn = document.getElementById('uploadBtn');
25
+
26
+ // Check system status on load
27
+ window.addEventListener('load', checkSystemStatus);
28
+
29
+ // Event Listeners
30
+ submitBtn.addEventListener('click', submitQuery);
31
+ queryInput.addEventListener('keypress', (e) => {
32
+ if (e.key === 'Enter' && !e.shiftKey) {
33
+ e.preventDefault();
34
+ submitQuery();
35
+ }
36
+ });
37
+
38
+ // Sample query buttons
39
+ document.querySelectorAll('.sample-btn').forEach(btn => {
40
+ btn.addEventListener('click', () => {
41
+ queryInput.value = btn.dataset.query;
42
+ submitQuery();
43
+ });
44
+ });
45
+
46
+ // Initialize button
47
+ initBtn.addEventListener('click', initializeSystem);
48
+
49
+ // Stats modal
50
+ statsBtn.addEventListener('click', showStats);
51
+ document.querySelector('.close').addEventListener('click', () => {
52
+ statsModal.style.display = 'none';
53
+ });
54
+
55
+ // File upload
56
+ uploadBtn.addEventListener('click', uploadDocument);
57
+
58
+ // Functions
59
+ async function checkSystemStatus() {
60
+ try {
61
+ const response = await fetch(`${API_BASE}/api/status`);
62
+ const data = await response.json();
63
+
64
+ if (data.is_initialized) {
65
+ statusIndicator.className = 'status-indicator ready';
66
+ statusText.textContent = 'System Ready';
67
+ mainContent.style.display = 'block';
68
+ initSection.style.display = 'none';
69
+ } else {
70
+ statusIndicator.className = 'status-indicator not-ready';
71
+ statusText.textContent = 'System Not Initialized';
72
+ mainContent.style.display = 'none';
73
+ initSection.style.display = 'block';
74
+ }
75
+ } catch (error) {
76
+ console.error('Error checking status:', error);
77
+ statusIndicator.className = 'status-indicator not-ready';
78
+ statusText.textContent = 'Connection Error';
79
+ }
80
+ }
81
+
82
+ async function initializeSystem() {
83
+ const apiKey = apiKeyInput.value.trim();
84
+ if (!apiKey) {
85
+ alert('Please enter an API key');
86
+ return;
87
+ }
88
+
89
+ loading.style.display = 'block';
90
+ initSection.style.display = 'none';
91
+
92
+ try {
93
+ const response = await fetch(`${API_BASE}/api/initialize`, {
94
+ method: 'POST',
95
+ headers: {
96
+ 'Content-Type': 'application/json',
97
+ },
98
+ body: JSON.stringify({ api_key: apiKey })
99
+ });
100
+
101
+ if (response.ok) {
102
+ const data = await response.json();
103
+ apiKeyInput.value = '';
104
+ await checkSystemStatus();
105
+ } else {
106
+ const error = await response.json();
107
+ alert(`Initialization failed: ${error.detail}`);
108
+ initSection.style.display = 'block';
109
+ }
110
+ } catch (error) {
111
+ console.error('Error initializing system:', error);
112
+ alert('Failed to initialize system');
113
+ initSection.style.display = 'block';
114
+ } finally {
115
+ loading.style.display = 'none';
116
+ }
117
+ }
118
+
119
+ async function submitQuery() {
120
+ const query = queryInput.value.trim();
121
+ if (!query) {
122
+ alert('Please enter a question');
123
+ return;
124
+ }
125
+
126
+ loading.style.display = 'block';
127
+ resultsSection.style.display = 'none';
128
+
129
+ try {
130
+ const response = await fetch(`${API_BASE}/api/query`, {
131
+ method: 'POST',
132
+ headers: {
133
+ 'Content-Type': 'application/json',
134
+ },
135
+ body: JSON.stringify({ query: query })
136
+ });
137
+
138
+ if (response.ok) {
139
+ const data = await response.json();
140
+ displayResults(data);
141
+ } else {
142
+ const error = await response.json();
143
+ answerContent.innerHTML = `<div class="error-message">Error: ${error.detail}</div>`;
144
+ resultsSection.style.display = 'block';
145
+ }
146
+ } catch (error) {
147
+ console.error('Error submitting query:', error);
148
+ answerContent.innerHTML = `<div class="error-message">Failed to process query</div>`;
149
+ resultsSection.style.display = 'block';
150
+ } finally {
151
+ loading.style.display = 'none';
152
+ }
153
+ }
154
+
155
+ function displayResults(data) {
156
+ answerContent.textContent = data.answer;
157
+
158
+ // Display token info
159
+ if (data.token_usage && Object.keys(data.token_usage).length > 0) {
160
+ tokenInfo.innerHTML = `
161
+ <strong>Tokens:</strong>
162
+ Prompt: ${data.token_usage.prompt_tokens || 0},
163
+ Completion: ${data.token_usage.completion_tokens || 0},
164
+ Total: ${data.token_usage.total_tokens || 0}
165
+ `;
166
+ } else {
167
+ tokenInfo.innerHTML = '';
168
+ }
169
+
170
+ // Display processing time
171
+ timeInfo.innerHTML = `<strong>Processing Time:</strong> ${data.processing_time}s`;
172
+
173
+ // Display sources
174
+ if (data.sources && data.sources.length > 0) {
175
+ sourcesList.innerHTML = data.sources.map(source =>
176
+ `<div class="source-item">${source}</div>`
177
+ ).join('');
178
+ sourcesSection.style.display = 'block';
179
+ } else {
180
+ sourcesSection.style.display = 'none';
181
+ }
182
+
183
+ resultsSection.style.display = 'block';
184
+ }
185
+
186
+ async function showStats() {
187
+ try {
188
+ const response = await fetch(`${API_BASE}/api/token-stats`);
189
+ const data = await response.json();
190
+
191
+ if (data.total_calls !== undefined) {
192
+ statsContent.innerHTML = `
193
+ <div class="stat-item">
194
+ <span>Total API Calls:</span>
195
+ <span>${data.total_calls}</span>
196
+ </div>
197
+ <div class="stat-item">
198
+ <span>Total Prompt Tokens:</span>
199
+ <span>${data.total_prompt_tokens}</span>
200
+ </div>
201
+ <div class="stat-item">
202
+ <span>Total Completion Tokens:</span>
203
+ <span>${data.total_completion_tokens}</span>
204
+ </div>
205
+ <div class="stat-item">
206
+ <span>Total Tokens:</span>
207
+ <span>${data.total_tokens}</span>
208
+ </div>
209
+ `;
210
+ } else {
211
+ statsContent.innerHTML = '<p>No statistics available</p>';
212
+ }
213
+
214
+ statsModal.style.display = 'flex';
215
+ } catch (error) {
216
+ console.error('Error fetching stats:', error);
217
+ alert('Failed to fetch statistics');
218
+ }
219
+ }
220
+
221
+ async function uploadDocument() {
222
+ const file = fileInput.files[0];
223
+ if (!file) {
224
+ alert('Please select a file');
225
+ return;
226
+ }
227
+
228
+ loading.style.display = 'block';
229
+
230
+ const formData = new FormData();
231
+ formData.append('file', file);
232
+
233
+ try {
234
+ const response = await fetch(`${API_BASE}/api/upload-document`, {
235
+ method: 'POST',
236
+ body: formData
237
+ });
238
+
239
+ if (response.ok) {
240
+ const data = await response.json();
241
+ alert(data.message);
242
+ fileInput.value = '';
243
+ await checkSystemStatus();
244
+ } else {
245
+ const error = await response.json();
246
+ alert(`Upload failed: ${error.detail}`);
247
+ }
248
+ } catch (error) {
249
+ console.error('Error uploading document:', error);
250
+ alert('Failed to upload document');
251
+ } finally {
252
+ loading.style.display = 'none';
253
+ }
254
+ }
255
+
256
+ // Close modal when clicking outside
257
+ window.addEventListener('click', (event) => {
258
+ if (event.target === statsModal) {
259
+ statsModal.style.display = 'none';
260
+ }
261
+ });
static/style.css ADDED
File without changes