Best Python code snippet using fMBT_python
app.py
Source:app.py
1#!/usr/bin/env python2# coding: utf-83# In[1]:4import numpy as np5from flask import Flask,request,jsonify,render_template6import pickle7from sklearn.preprocessing import StandardScaler8# In[2]:9app= Flask(__name__)10model=pickle.load(open('model.pkl','rb'))11# In[3]:12@app.route('/')13def home():14 return render_template('index.html')15# In[4]:16State_dict={'Chandigarh': 0,17 'Mizoram': 1,18 'Arunanchal Pradesh': 2,19 'Sikkim': 3,20 'Nagaland': 4,21 'Meghalaya': 5,22 'Manipur': 6,23 'Dadara & Nagar Havelli': 7,24 'Himachal Pradesh': 8,25 'Tripura': 9,26 'Jharkhand': 10,27 'Jammu & Kashmir': 11,28 'Chhattisgarh': 12,29 'Odisha': 13,30 'Madhya Pradesh': 14,31 'Bihar': 15,32 'Rajasthan': 16,33 'Uttarakhand': 17,34 'Karnataka': 18,35 'Gujarat': 19,36 'Telangana': 20,37 'Haryana': 21,38 'Maharashtra': 22,39 'Uttar Pradesh': 23,40 'Assam': 24,41 'West Bengal': 25,42 'Punjab': 26,43 'Puducherry': 27,44 'Tamil Nadu': 28,45 'Andhra Pradesh': 29,46 'Goa': 30,47 'Andaman & Nicobar Island': 31,48 'Kerala': 32,49 'Andamanandnicobarislands': 31,50 'Andhrapradesh': 29,51 'Arunachalpradesh': 2,52 'Dadraandnagarhavelli': 7,53 'Himachalpradesh': 8,54 'Jammuandkashmir': 11,55 'Madhyapradesh': 14,56 'Tamilnadu': 28,57 'Uttarpradesh': 23,58 'Westbengal': 25}59# In[5]:60Dist_dict={'MUMBAI': 0,61 'MAMIT': 1,62 'LEH LADAKH': 2,63 'KINNAUR': 3,64 'LAWNGTLAI': 4,65 'KARGIL': 5,66 'HYDERABAD': 6,67 'CHANDIGARH': 7,68 'KURUNG KUMEY': 8,69 'NAMSAI': 9,70 'SAIHA': 10,71 'KHUNTI': 11,72 'NORTH DISTRICT': 12,73 'RAMGARH': 13,74 'SOUTH GARO HILLS': 14,75 'ANJAW': 15,76 'NORTH GARO HILLS': 16,77 'WEST JAINTIA HILLS': 17,78 'TAWANG': 18,79 'NARAYANPUR': 19,80 'SHOPIAN': 20,81 'LUNGLEI': 21,82 'WEST KAMENG': 22,83 'TIRAP': 23,84 'SOUTH WEST KHASI HILLS': 24,85 'CHAMPHAI': 25,86 'LONGLENG': 26,87 'PALGHAR': 27,88 'UPPER SIANG': 28,89 'UPPER SUBANSIRI': 29,90 'KISHTWAR': 30,91 'EAST KAMENG': 31,92 'LONGDING': 32,93 'KOLASIB': 33,94 'TAMENGLONG': 34,95 'SERCHHIP': 35,96 'CHAMPAWAT': 36,97 'CHANDEL': 37,98 'SRINAGAR': 38,99 'DIBANG VALLEY': 39,100 'KIPHIRE': 40,101 'LOWER SUBANSIRI': 41,102 'EAST JAINTIA HILLS': 42,103 'RUDRA PRAYAG': 43,104 'MON': 44,105 'PAPUM PARE': 45,106 'LAHUL AND SPITI': 46,107 'ZUNHEBOTO': 47,108 'KONDAGAON': 48,109 'MOKOKCHUNG': 49,110 'SOUTH WEST GARO HILLS': 50,111 'BANDIPORA': 51,112 'KODERMA': 52,113 'ARWAL': 53,114 'CHANGLANG': 54,115 'LATEHAR': 55,116 'BAGESHWAR': 56,117 'EAST GARO HILLS': 57,118 'KOHIMA': 58,119 'PEREN': 59,120 'UMARIA': 60,121 'REASI': 61,122 'UKHRUL': 62,123 'PHEK': 63,124 'AIZAWL': 64,125 'RAMBAN': 65,126 'WOKHA': 66,127 'WEST DISTRICT': 67,128 'BOKARO': 68,129 'TUENSANG': 69,130 'EAST DISTRICT': 70,131 'WEST SIANG': 71,132 'DEOGARH': 72,133 'RI BHOI': 73,134 'KOREA': 74,135 'WEST KHASI HILLS': 75,136 'DHALAI': 76,137 'KANDHAMAL': 77,138 'UNAKOTI': 78,139 'KULGAM': 79,140 'GANDERBAL': 80,141 'BENGALURU URBAN': 81,142 'GARHWA': 82,143 'GAJAPATI': 83,144 'RAYAGADA': 84,145 'CHURACHANDPUR': 85,146 'MUNGER': 86,147 'SAHEBGANJ': 87,148 'LOWER DIBANG VALLEY': 88,149 'JHARSUGUDA': 89,150 'ANUPPUR': 90,151 'SHIMLA': 91,152 'SENAPATI': 92,153 'UTTAR KASHI': 93,154 'KORBA': 94,155 'BOUDH': 95,156 'SOUTH DISTRICT': 96,157 'DANG': 97,158 'DHANBAD': 98,159 'EAST SIANG': 99,160 'PITHORAGARH': 100,161 'BISHNUPUR': 101,162 'NUAPADA': 102,163 'NORTH TRIPURA': 103,164 'LOHARDAGA': 104,165 'LOHIT': 105,166 'KHOWAI': 106,167 'THE NILGIRIS': 107,168 'CHATRA': 108,169 'PULWAMA': 109,170 'CHAMBA': 110,171 'PAURI GARHWAL': 111,172 'AGAR MALWA': 112,173 'KULLU': 113,174 'SHEIKHPURA': 114,175 'THOUBAL': 115,176 'SOLAN': 116,177 'BADGAM': 117,178 'JASHPUR': 118,179 'RAJSAMAND': 119,180 'ALIRAJPUR': 120,181 'IMPHAL WEST': 121,182 'SURAJPUR': 122,183 'SIMDEGA': 123,184 'TEHRI GARHWAL': 124,185 'JAMUI': 125,186 'SARAIKELA KHARSAWAN': 126,187 'JAISALMER': 127,188 'JAMTARA': 128,189 'IMPHAL EAST': 129,190 'PAKUR': 130,191 'DANTEWADA': 131,192 'SIROHI': 132,193 'GODDA': 133,194 'DINDORI': 134,195 'SAMBA': 135,196 'Dadara & Nagar Havelli': 136,197 'DUNGARPUR': 137,198 'BALODA BAZAR': 138,199 'PALAMU': 139,200 'NAWADA': 140,201 'SHEOHAR': 141,202 'ANUGUL': 142,203 'DODA': 143,204 'CHAMOLI': 144,205 'KABIRDHAM': 145,206 'UNA': 146,207 'CHIKBALLAPUR': 147,208 'ALMORA': 148,209 'RAIGARH': 149,210 'SUKMA': 150,211 'SHAHDOL': 151,212 'SIRMAUR': 152,213 'GOMATI': 153,214 'DIMAPUR': 154,215 'WEST GARO HILLS': 155,216 'KHAGARIA': 156,217 'MALKANGIRI': 157,218 'PANCHKULA': 158,219 'MANDLA': 159,220 'GARIYABAND': 160,221 'KODAGU': 161,222 'KATHUA': 162,223 'JEHANABAD': 163,224 'KUPWARA': 164,225 'BASTAR': 165,226 'EAST KHASI HILLS': 166,227 'SINGRAULI': 167,228 'KATNI': 168,229 'LAKHISARAI': 169,230 'KHORDHA': 170,231 'PANNA': 171,232 'KANKER': 172,233 'DHAMTARI': 173,234 'RAMANAGARA': 174,235 'GUMLA': 175,236 'TINSUKIA': 176,237 'CHITRAKOOT': 177,238 'AJMER': 178,239 'SIDHI': 179,240 'DHENKANAL': 180,241 'JAJAPUR': 181,242 'SOUTH TRIPURA': 182,243 'BARWANI': 183,244 'WEST TRIPURA': 184,245 'UDHAMPUR': 185,246 'SAMBALPUR': 186,247 'HAZARIBAGH': 187,248 'DEOGHAR': 188,249 'DIMA HASAO': 189,250 'JHABUA': 190,251 'GIRIDIH': 191,252 'SONEPUR': 192,253 'BEGUSARAI': 193,254 'TIKAMGARH': 194,255 'JAGATSINGHAPUR': 195,256 'KENDUJHAR': 196,257 'GADCHIROLI': 197,258 'MUNGELI': 198,259 'MADHUBANI': 199,260 'BANGALORE RURAL': 200,261 'PALI': 201,262 'SURGUJA': 202,263 'UTTAR KANNAD': 203,264 'MAHOBA': 204,265 'SONBHADRA': 205,266 'SEPAHIJALA': 206,267 'DUMKA': 207,268 'SANT RAVIDAS NAGAR': 208,269 'BARAMULLA': 209,270 'VAISHALI': 210,271 'YADGIR': 211,272 'BANSWARA': 212,273 'BHOPAL': 213,274 'SAHARSA': 214,275 'BALOD': 215,276 'MAHASAMUND': 216,277 'DARBHANGA': 217,278 'WEST SINGHBHUM': 218,279 'NEEMUCH': 219,280 'NAYAGARH': 220,281 'RAJNANDGAON': 221,282 'BILASPUR': 222,283 'KOLAR': 223,284 'SUNDARGARH': 224,285 'GAYA': 225,286 'SATNA': 226,287 'JANJGIR-CHAMPA': 227,288 'GONDIA': 228,289 'KENDRAPARA': 229,290 'UDAIPUR': 230,291 'KANGRA': 231,292 'POONCH': 232,293 'DAMOH': 233,294 'ANANTNAG': 234,295 'RAJAURI': 235,296 'KISHANGANJ': 236,297 'BHAGALPUR': 237,298 'BALANGIR': 238,299 'GADAG': 239,300 'JAMMU': 240,301 'JALORE': 241,302 'RANGAREDDI': 242,303 'MANDI': 243,304 'DIBRUGARH': 244,305 'BALAGHAT': 245,306 'BEMETARA': 246,307 'HAMIRPUR': 247,308 'NALANDA': 248,309 'SARAN': 249,310 'CHIKMAGALUR': 250,311 'BARMER': 251,312 'KORAPUT': 252,313 'UDUPI': 253,314 'NABARANGPUR': 254,315 'REWA': 255,316 'PURI': 256,317 'PANCH MAHALS': 257,318 'DHARWAD': 258,319 'DHEMAJI': 259,320 'SHEOPUR': 260,321 'BANKA': 261,322 'KAUSHAMBI': 262,323 'JABALPUR': 263,324 'EAST SINGHBUM': 264,325 'SEONI': 265,326 'SUPAUL': 266,327 'BUXAR': 267,328 'KOPPAL': 268,329 'CHHATARPUR': 269,330 'KALAHANDI': 270,331 'BHILWARA': 271,332 'NAINITAL': 272,333 'LUCKNOW': 273,334 'SAWAI MADHOPUR': 274,335 'MADHEPURA': 275,336 'BHIND': 276,337 'MUZAFFARPUR': 277,338 'KHARGONE': 278,339 'DHOLPUR': 279,340 'BANDA': 280,341 'PATNA': 281,342 'CUTTACK': 282,343 'DATIA': 283,344 'BALESHWAR': 284,345 'BHOJPUR': 285,346 'GANDHINAGAR': 286,347 'TONK': 287,348 'PORBANDAR': 288,349 'BHADRAK': 289,350 'SAMASTIPUR': 290,351 'ASHOKNAGAR': 291,352 'SAGAR': 292,353 'LALITPUR': 293,354 'HAVERI': 294,355 'HARDA': 295,356 'SIWAN': 296,357 'RAIPUR': 297,358 'KARAULI': 298,359 'DAUSA': 299,360 'PURULIA': 300,361 'GWALIOR': 301,362 'SINDHUDURG': 302,363 'KHANDWA': 303,364 'KAIMUR (BHABUA)': 304,365 'JHANSI': 305,366 'MAYURBHANJ': 306,367 'DARJEELING': 307,368 'RAJGARH': 308,369 'GUNA': 309,370 'RANCHI': 310,371 'KATIHAR': 311,372 'BIKANER': 312,373 'DOHAD': 313,374 'JHALAWAR': 314,375 'CHITRADURGA': 315,376 'THANE': 316,377 'ADILABAD': 317,378 'ARARIA': 318,379 'DURG': 319,380 'RATNAGIRI': 320,381 'RATLAM': 321,382 'MIRZAPUR': 322,383 'BELLARY': 323,384 'PATAN': 324,385 'RAICHUR': 325,386 'SHRAVASTI': 326,387 'WASHIM': 327,388 'BETUL': 328,389 'VARANASI': 329,390 'HAILAKANDI': 330,391 'PURNIA': 331,392 'SHIVPURI': 332,393 'MANDSAUR': 333,394 'CHANDAULI': 334,395 'GANJAM': 335,396 'BARGARH': 336,397 'RAISEN': 337,398 'BUNDI': 338,399 'BURHANPUR': 339,400 'KOTA': 340,401 'BHANDARA': 341,402 'MORENA': 342,403 'BARAN': 343,404 'JODHPUR': 344,405 'CHANDRAPUR': 345,406 'INDORE': 346,407 'DEHRADUN': 347,408 'SITAMARHI': 348,409 'CHAMARAJANAGAR': 349,410 'CHURU': 350,411 'CHITTORGARH': 351,412 'DAKSHIN KANNAD': 352,413 'VIDISHA': 353,414 'KAMRUP METRO': 354,415 'PRATAPGARH': 355,416 'GAUTAM BUDDHA NAGAR': 356,417 'SIKAR': 357,418 'TUMKUR': 358,419 'ETAWAH': 359,420 'HOSHANGABAD': 360,421 'AMETHI': 361,422 'SANT KABEER NAGAR': 362,423 'SEHORE': 363,424 'SHAJAPUR': 364,425 'RAIGAD': 365,426 'JALAUN': 366,427 'KADAPA': 367,428 'BHARATPUR': 368,429 'NAGPUR': 369,430 'REWARI': 370,431 'WARDHA': 371,432 'KANPUR DEHAT': 372,433 'AURAIYA': 373,434 'DHAR': 374,435 'AKOLA': 375,436 'JHUNJHUNU': 376,437 'ROHTAS': 377,438 'DEWAS': 378,439 'MAHBUBNAGAR': 379,440 'UNNAO': 380,441 'DHULE': 381,442 'PURBI CHAMPARAN': 382,443 'HASSAN': 383,444 'UJJAIN': 384,445 'MAHESANA': 385,446 'RAE BARELI': 386,447 'SHIMOGA': 387,448 'NANDURBAR': 388,449 'KACHCHH': 389,450 'MAU': 390,451 'AHMADABAD': 391,452 'KANPUR NAGAR': 392,453 'MYSORE': 393,454 'KHEDA': 394,455 'LAKHIMPUR': 395,456 'AMRAVATI': 396,457 'SABAR KANTHA': 397,458 'NAGAUR': 398,459 'GULBARGA': 399,460 'PRAKASAM': 400,461 'KASGANJ': 401,462 'CHHINDWARA': 402,463 'WARANGAL': 403,464 'GURGAON': 404,465 'DAVANGERE': 405,466 'GORAKHPUR': 406,467 'SIDDHARTH NAGAR': 407,468 'GOPALGANJ': 408,469 'NARSINGHPUR': 409,470 'JALPAIGURI': 410,471 'MAHENDRAGARH': 411,472 'VADODARA': 412,473 'BULDHANA': 413,474 'FATEHPUR': 414,475 'NALGONDA': 415,476 'JHAJJAR': 416,477 'HATHRAS': 417,478 'TAPI': 418,479 'JAIPUR': 419,480 'ALLAHABAD': 420,481 'MAINPURI': 421,482 'KURNOOL': 422,483 'HINGOLI': 423,484 'S.A.S NAGAR': 424,485 'BALLIA': 425,486 'FARIDABAD': 426,487 'BIDAR': 427,488 'NARMADA': 428,489 'HANUMANGARH': 429,490 'MEWAT': 430,491 'SULTANPUR': 431,492 'DINAJPUR UTTAR': 432,493 'BIJAPUR': 433,494 'GHAZIPUR': 434,495 'AURANGABAD': 435,496 'NANDED': 436,497 'DINAJPUR DAKSHIN': 437,498 'CHIRANG': 438,499 'AMBEDKAR NAGAR': 439,500 'ALWAR': 440,501 'KANNAUJ': 441,502 'GANGANAGAR': 442,503 'JAMNAGAR': 443,504 'DEORIA': 444,505 'ANAND': 445,506 'FIROZABAD': 446,507 'YAVATMAL': 447,508 'BANAS KANTHA': 448,509 'AMRELI': 449,510 'PARBHANI': 450,511 'MATHURA': 451,512 'KOKRAJHAR': 452,513 'NIZAMABAD': 453,514 'FAIZABAD': 454,515 'PANIPAT': 455,516 'KARBI ANGLONG': 456,517 'CACHAR': 457,518 'JALNA': 458,519 'OSMANABAD': 459,520 'FARRUKHABAD': 460,521 'SURENDRANAGAR': 461,522 'ETAH': 462,523 'KARIMGANJ': 463,524 'KARIMNAGAR': 464,525 'MANDYA': 465,526 'PATHANKOT': 466,527 'JAUNPUR': 467,528 'SIVASAGAR': 468,529 'PALWAL': 469,530 'BANKURA': 470,531 'BAHRAICH': 471,532 'MALDAH': 472,533 'BARABANKI': 473,534 'AZAMGARH': 474,535 'BHIWANI': 475,536 'ROHTAK': 476,537 'NAVSARI': 477,538 'UDALGURI': 478,539 'MAHARAJGANJ': 479,540 'HISAR': 480,541 'VALSAD': 481,542 'ALIGARH': 482,543 'ARIYALUR': 483,544 'RUPNAGAR': 484,545 'RAJKOT': 485,546 'HAPUR': 486,547 'BHAVNAGAR': 487,548 'AGRA': 488,549 'JORHAT': 489,550 'MEDAK': 490,551 'FATEHABAD': 491,552 'BHARUCH': 492,553 'SONIPAT': 493,554 'RAMPUR': 494,555 'BONGAIGAON': 495,556 'PERAMBALUR': 496,557 '24 PARAGANAS NORTH': 497,558 'BALRAMPUR': 498,559 'NASHIK': 499,560 'SAMBHAL': 500,561 'GOALPARA': 501,562 'LATUR': 502,563 'JALGAON': 503,564 'AMBALA': 504,565 'ANANTAPUR': 505,566 'DHUBRI': 506,567 'DARRANG': 507,568 'BASTI': 508,569 'JUNAGADH': 509,570 'KARNAL': 510,571 'UDAM SINGH NAGAR': 511,572 'KAITHAL': 512,573 'JIND': 513,574 'SIRSA': 514,575 'GONDA': 515,576 'FARIDKOT': 516,577 'GUNTUR': 517,578 'BIRBHUM': 518,579 'COOCHBEHAR': 519,580 'BUDAUN': 520,581 'BEED': 521,582 'MANSA': 522,583 'PASHCHIM CHAMPARAN': 523,584 'HARDOI': 524,585 'HOSHIARPUR': 525,586 'NAWANSHAHR': 526,587 'BAGALKOT': 527,588 'MOGA': 528,589 'KARAIKAL': 529,590 'KURUKSHETRA': 530,591 'FATEHGARH SAHIB': 531,592 'BARNALA': 532,593 'SHAHJAHANPUR': 533,594 'BULANDSHAHR': 534,595 'MUKTSAR': 535,596 'KAPURTHALA': 536,597 'MARIGAON': 537,598 'YAMUNANAGAR': 538,599 'SATARA': 539,600 'KUSHI NAGAR': 540,601 'THIRUVALLUR': 541,602 'TARN TARAN': 542,603 'GHAZIABAD': 543,604 'BATHINDA': 544,605 'TUTICORIN': 545,606 'MORADABAD': 546,607 'PILIBHIT': 547,608 'SANGLI': 548,609 'MEDINIPUR WEST': 549,610 'SONITPUR': 550,611 'HARIDWAR': 551,612 'BAKSA': 552,613 'PATIALA': 553,614 'JALANDHAR': 554,615 'AHMEDNAGAR': 555,616 'NADIA': 556,617 'TIRUVANNAMALAI': 557,618 'FAZILKA': 558,619 'BARPETA': 559,620 'KARUR': 560,621 'BARDHAMAN': 561,622 'SPSR NELLORE': 562,623 'AMRITSAR': 563,624 'LUDHIANA': 564,625 'SITAPUR': 565,626 'SHAMLI': 566,627 'KHAMMAM': 567,628 'TIRUCHIRAPPALLI': 568,629 'BAREILLY': 569,630 'PUNE': 570,631 'AMROHA': 571,632 'BAGHPAT': 572,633 'NALBARI': 573,634 'MEDINIPUR EAST': 574,635 'GURDASPUR': 575,636 'HOWRAH': 576,637 'BELGAUM': 577,638 'SOLAPUR': 578,639 'HOOGHLY': 579,640 'SANGRUR': 580,641 'NAGAPATTINAM': 581,642 'GOLAGHAT': 582,643 'FIROZEPUR': 583,644 'MURSHIDABAD': 584,645 'KANCHIPURAM': 585,646 'KAMRUP': 586,647 'SURAT': 587,648 '24 PARAGANAS SOUTH': 588,649 'SAHARANPUR': 589,650 'YANAM': 590,651 'KHERI': 591,652 'CUDDALORE': 592,653 'KOLHAPUR': 593,654 'VILLUPURAM': 594,655 'PONDICHERRY': 595,656 'RAMANATHAPURAM': 596,657 'PUDUKKOTTAI': 597,658 'MEERUT': 598,659 'MAHE': 599,660 'DHARMAPURI': 600,661 'BIJNOR': 601,662 'SIVAGANGA': 602,663 'MADURAI': 603,664 'VIZIANAGARAM': 604,665 'NAMAKKAL': 605,666 'CHITTOOR': 606,667 'KRISHNA': 607,668 'MUZAFFARNAGAR': 608,669 'SALEM': 609,670 'VIRUDHUNAGAR': 610,671 'TIRUNELVELI': 611,672 'THIRUVARUR': 612,673 'NAGAON': 613,674 'ERODE': 614,675 'KANNIYAKUMARI': 615,676 'VELLORE': 616,677 'SOUTH ANDAMANS': 617,678 'NORTH AND MIDDLE ANDAMAN': 618,679 'VISAKHAPATANAM': 619,680 'KRISHNAGIRI': 620,681 'DINDIGUL': 621,682 'THENI': 622,683 'SRIKAKULAM': 623,684 'NORTH GOA': 624,685 'THANJAVUR': 625,686 'SOUTH GOA': 626,687 'WAYANAD': 627,688 'IDUKKI': 628,689 'TIRUPPUR': 629,690 'NICOBARS': 630,691 'COIMBATORE': 631,692 'WEST GODAVARI': 632,693 'PATHANAMTHITTA': 633,694 'EAST GODAVARI': 634,695 'KOTTAYAM': 635,696 'PALAKKAD': 636,697 'ERNAKULAM': 637,698 'KOLLAM': 638,699 'ALAPPUZHA': 639,700 'KASARAGOD': 640,701 'KANNUR': 641,702 'THIRUVANANTHAPURAM': 642,703 'THRISSUR': 643,704 'MALAPPURAM': 644,705 'KOZHIKODE': 645,706 'DADRA AND NAGARHAVELI' :136}707# In[6]:708Season_dict={'Summer': 0,709 'Autumn': 1,710 'Rabi': 2,711 'Kharif': 3,712 'Winter': 4,713 'Wholeyear': 5}714# In[7]:715Crop_dict={'Apple': 0,716 'Pump kin': 1,717 'Snak Guard': 2,718 'Cucumber': 3,719 'Lab-Lab': 4,720 'Plums': 5,721 'Ribed Guard': 6,722 'Litchi': 7,723 'Ber': 8,724 'Beet Root': 9,725 'Other Citrus Fruit': 10,726 'Pear': 11,727 'other fibres': 12,728 'Peas (vegetable)': 13,729 'Yam': 14,730 'Peach': 15,731 'Ash Gourd': 16,732 'Water Melon': 17,733 'Bitter Gourd': 18,734 'Bottle Gourd': 19,735 'Turnip': 20,736 'Redish': 21,737 'Cond-spcs other': 22,738 'Jobster': 23,739 'Carrot': 24,740 'other misc. pulses': 25,741 'Perilla': 26,742 'Sannhamp': 27,743 'Cauliflower': 28,744 'Cashewnut Processed': 29,745 'Cardamom': 30,746 'Bean': 31,747 'Lentil': 32,748 'Cowpea(Lobia)': 33,749 'Ricebean (nagadal)': 34,750 'Blackgram': 35,751 'Linseed': 36,752 'Jack Fruit': 37,753 'Kapas': 38,754 'Niger seed': 39,755 'Drum Stick': 40,756 'Korra': 41,757 'Pome Granet': 42,758 'Varagu': 43,759 'Other Fresh Fruits': 44,760 'Bhindi': 45,761 'Rajmash Kholar': 46,762 'Horse-gram': 47,763 'Coriander': 48,764 'Sesamum': 49,765 'Small millets': 50,766 'Other Kharif pulses': 51,767 'Beans & Mutter(Vegetable)': 52,768 'Other Rabi pulses': 53,769 'Moong(Green Gram)': 54,770 'Pome Fruit': 55,771 'Peas & beans (Pulses)': 56,772 'Cabbage': 57,773 'Sweet potato': 58,774 'Other Vegetables': 59,775 'Black pepper': 60,776 'Samai': 61,777 'Other Cereals & Millets': 62,778 'Citrus Fruit': 63,779 'Safflower': 64,780 'Sunflower': 65,781 'Cashewnut': 66,782 'Urad': 67,783 'Turmeric': 68,784 'Dry chillies': 69,785 'Tea': 70,786 'Garlic': 71,787 'Dry ginger': 72,788 'Masoor': 73,789 'Ginger': 74,790 'Cashewnut Raw': 75,791 'Brinjal': 76,792 'Moth': 77,793 'Tobacco': 78,794 'Castor seed': 79,795 'Khesari': 80,796 'Colocosia': 81,797 'Arhar/Tur': 82,798 'Barley': 83,799 'Jute & mesta': 84,800 'Mesta': 85,801 'Sapota': 86,802 'Lemon': 87,803 'Orange': 88,804 'Pineapple': 89,805 'Ragi': 90,806 'Papaya': 91,807 'other oilseeds': 92,808 'Arcanut (Processed)': 93,809 'Onion': 94,810 'Guar seed': 95,811 'Rapeseed &Mustard': 96,812 'Arecanut': 97,813 'Groundnut': 98,814 'Gram': 99,815 'Tomato': 100,816 'Grapes': 101,817 'Jowar': 102,818 'Maize': 103,819 'Bajra': 104,820 'Coffee': 105,821 'Mango': 106,822 'Rubber': 107,823 'Soyabean': 108,824 'Banana': 109,825 'Atcanut (Raw)': 110,826 'Potato': 111,827 'Pulses total': 112,828 'Paddy': 113,829 'Tapioca': 114,830 'Cotton(lint)': 115,831 'Oilseeds total': 116,832 'Rice': 117,833 'Jute': 118,834 'Wheat': 119,835 'Total foodgrain': 120,836 'Sugarcane': 121,837 'Coconut': 122}838# In[8]:839Year_dict={2015: 0,840 1997: 1,841 2001: 2,842 2010: 3,843 2007: 4,844 2006: 5,845 2002: 6,846 1999: 7,847 2009: 8,848 2008: 9,849 2003: 10,850 2000: 11,851 2012: 12,852 2004: 13,853 2005: 14,854 1998: 15,855 2013: 16,856 2014: 17,857 2011: 18,858 2016: 19,859 2017: 20,860 2018: 21,861 2019: 22,862 2020: 23,863 2021: 24,864 2022: 25,865 2023: 26,866 2024: 27,867 2025: 28,868 2026: 29,869 2027: 30, 870 2028: 31, 871 2029: 32, 872 2030: 33, 873 2031: 34, 874 2032: 35, 875 2033: 36, 876 2034: 37, 877 2035: 38, 878 2036: 39, 879 2037: 40,880 2038: 41, 881 2039: 42, 882 2040: 43, 883 2041: 44, 884 2042: 45, 885 2043: 46, 886 2044: 47, 887 2045: 48,888 2046: 49, 889 2047: 50, 890 2048: 51, 891 2049: 52, 892 2050: 53, 893 2051: 54}894 895# In[9]:896a="Andaman & Nicobar Island"897# In[10]:898print(State_dict.get(a))899# In[11]:900import datetime901now = datetime.datetime.now()902check_year=now.year903print(check_year)904predict_year=check_year+2905print('predict_year',predict_year)906standard_to = StandardScaler()907@app.route('/predict',methods=['POST'])908def predict():909 #int_features=[String(x) for x in request.form.values()]910 #final_features =[np.array(int_features)]911 if request.method == 'POST':912 State_Name=request.form['State_Name']913 State_Name1=State_Name914 State_Name=State_Name.capitalize()915 State_Name=State_dict.get(State_Name)916 District_Name =request.form['District_Name']917 District_Name1=District_Name918 District_Name=District_Name.upper()919 District_Name=Dist_dict.get(District_Name)920 Crop_Year=int(request.form['Crop_Year'])921 Crop_Year_original=Crop_Year922 if Crop_Year<1998:923 Crop_Year1=Crop_Year924 #Crop_Year=1925 Crop_Year2=Crop_Year-2926 Crop_Year7=Crop_Year2927 Crop_Year2=1928 Crop_Year3=Crop_Year-1929 Crop_Year8=Crop_Year3930 Crop_Year3=1931 Crop_Year4=Crop_Year+1932 Crop_Year9=Crop_Year4933 Crop_Year4=1934 Crop_Year5=Crop_Year+2935 Crop_Year10=Crop_Year5936 Crop_Year5=1937 Crop_Year=1938 else:939 Crop_Year1=Crop_Year940 Crop_Year2=Crop_Year-2941 Crop_Year7=Crop_Year2942 Crop_Year3=Crop_Year-1943 Crop_Year8=Crop_Year3944 Crop_Year4=Crop_Year+1945 Crop_Year9=Crop_Year4946 Crop_Year5=Crop_Year+2947 Crop_Year10=Crop_Year5948 if Crop_Year<2052:949 Crop_Year=Year_dict.get(Crop_Year)950 else:951 Crop_Year=55952 if Crop_Year2<2052:953 Crop_Year2=Year_dict.get(Crop_Year2)954 else:955 Crop_Year2=55956 if Crop_Year3<2052:957 Crop_Year3=Year_dict.get(Crop_Year3)958 else:959 Crop_Year3=55960 if Crop_Year4<2052:961 Crop_Year4=Year_dict.get(Crop_Year4)962 else:963 Crop_Year4=55964 if Crop_Year5<2052:965 Crop_Year5=Year_dict.get(Crop_Year5)966 else:967 Crop_Year5=55968 Season=request.form['Season']969 Season1=Season970 Season=Season.capitalize()971 Season=Season_dict.get(Season)972 Crop=request.form['Crop']973 #Crop=Crop.capitalize()974 Crop1=Crop975 if Crop1=='Arhar/Tur':976 crop2='ArharTur'977 elif Crop1=='Castor seed':978 crop2='Castorseed'979 elif Crop1=='Cond-spcs other':980 crop2='Condspcsother'981 elif Crop1=='Cotton(lint)':982 crop2='Cottonlint'983 elif Crop1=='Moong(Green Gram)':984 crop2='MoongGreenGram'985 elif Crop1=='Rapeseed &Mustard':986 crop2='RapeseedMustard'987 else:988 crop2=Crop1989 Crop=Crop_dict.get(Crop)990 Area=float(request.form['Area'])991 Area_in=Area992 print([[State_Name,District_Name,Crop_Year,Season,Crop,Area]] ) 993 print([[State_Name,District_Name,Crop_Year2,Season,Crop,Area]] )994 print([[State_Name,District_Name,Crop_Year3,Season,Crop,Area]] )995 print([[State_Name,District_Name,Crop_Year4,Season,Crop,Area]] )996 print([[State_Name,District_Name,Crop_Year5,Season,Crop,Area]] )997 if Area<10:998 Area1=Area+5999 Area2=Area1+51000 Area3=Area2+51001 Area4=Area3+51002 elif Area<100:1003 Area1=Area+101004 Area2=Area1+101005 Area3=Area2+101006 Area4=Area3+101007 elif Area<1000:1008 Area1=Area+501009 Area2=Area1+501010 Area3=Area2+501011 Area4=Area3+501012 elif Area<10000:1013 Area1=Area+1001014 Area2=Area1+1001015 Area3=Area2+1001016 Area4=Area3+1001017 elif Area>9999:1018 Area1=Area+10001019 Area2=Area1+10001020 Area3=Area2+10001021 Area4=Area3+10001022 1023 prediction=model.predict([[State_Name,District_Name,Crop_Year,Season,Crop,Area]] ) 1024 prediction1=model.predict([[State_Name,District_Name,Crop_Year2,Season,Crop,Area]] )1025 prediction2=model.predict([[State_Name,District_Name,Crop_Year3,Season,Crop,Area]] )1026 prediction3=model.predict([[State_Name,District_Name,Crop_Year4,Season,Crop,Area]] )1027 prediction4=model.predict([[State_Name,District_Name,Crop_Year5,Season,Crop,Area]] )1028 prediction_Area1=model.predict([[State_Name,District_Name,Crop_Year,Season,Crop,Area1]] )1029 prediction_Area2=model.predict([[State_Name,District_Name,Crop_Year,Season,Crop,Area2]] )1030 prediction_Area3=model.predict([[State_Name,District_Name,Crop_Year,Season,Crop,Area3]] )1031 prediction_Area4=model.predict([[State_Name,District_Name,Crop_Year,Season,Crop,Area4]] )1032 1033 1034 1035 print('Crop_Year',Crop_Year_original)1036 if predict_year < Crop_Year_original:1037 prediction=01038 print('year_if')1039 return render_template('index.html',1040 prediction_text='The tool supports the prediction for next 2 years',1041 state='State_Name :{}'.format(State_Name1),1042 district='District_Name :{}'.format(District_Name1),1043 year='Crop_Year :{}'.format(Crop_Year1),1044 season='Season :{}'.format(Season1),1045 crop='Crop :{}'.format(Crop1),1046 Area='Area :{} ha'.format(Area_in))1047 #Arhar/Tur1048 if State_Name==30 and Crop==82 or State_Name==10 and Crop==82 or State_Name==6 and Crop==82 or State_Name==3 and Crop==82 :1049 prediction=01050 return render_template('index.html',1051 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1052 state='State_Name :{}'.format(State_Name1),1053 district='District_Name :{}'.format(District_Name1),1054 year='Crop_Year :{}'.format(Crop_Year1),1055 season='Season :{}'.format(Season1),1056 crop='Crop :{}'.format(Crop1),1057 Area='Area :{} ha'.format(Area_in))1058 #Banana1059 if State_Name==21 and Crop==109 or State_Name==8 and Crop==109 or State_Name==10 and Crop==109 or State_Name==26 and Crop==109 or State_Name==7 and Crop==109 or State_Name==17 and Crop==109 or State_Name==0 and Crop==109 :1060 prediction=01061 return render_template('index.html',1062 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1063 state='State_Name :{}'.format(State_Name1),1064 district='District_Name :{}'.format(District_Name1),1065 year='Crop_Year :{}'.format(Crop_Year1),1066 season='Season :{}'.format(Season1),1067 crop='Crop :{}'.format(Crop1),1068 Area='Area :{} ha'.format(Area_in))1069 1070 #Cabbage & Cauliflower1071 1072 if State_Name==30 and Crop==57 or State_Name==30 and Crop==28 or State_Name==20 and Crop==28 :1073 prediction=01074 return render_template('index.html',1075 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1076 state='State_Name :{}'.format(State_Name1),1077 district='District_Name :{}'.format(District_Name1),1078 year='Crop_Year :{}'.format(Crop_Year1),1079 season='Season :{}'.format(Season1),1080 crop='Crop :{}'.format(Crop1),1081 Area='Area :{} ha'.format(Area_in))1082 #Groundnut1083 if State_Name==24 and Crop==98 or State_Name==10 and Crop==98 or State_Name==1 and Crop==98 or State_Name==5 and Crop==98 or State_Name==3 and Crop==98 :1084 prediction=01085 return render_template('index.html',1086 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1087 state='State_Name :{}'.format(State_Name1),1088 district='District_Name :{}'.format(District_Name1),1089 year='Crop_Year :{}'.format(Crop_Year1),1090 season='Season :{}'.format(Season1),1091 crop='Crop :{}'.format(Crop1),1092 Area='Area :{} ha'.format(Area_in))1093 #Maize1094 if State_Name==30 and Crop==103 or State_Name==32 and Crop==103 or State_Name==27 and Crop==103 :1095 prediction=01096 return render_template('index.html',1097 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1098 state='State_Name :{}'.format(State_Name1),1099 district='District_Name :{}'.format(District_Name1),1100 year='Crop_Year :{}'.format(Crop_Year1),1101 season='Season :{}'.format(Season1),1102 crop='Crop :{}'.format(Crop1),1103 Area='Area :{} ha'.format(Area_in)) 1104 #Mango1105 if State_Name==5 and Crop==106 or State_Name==6 and Crop==106 or State_Name==3 and Crop==106 :1106 prediction=01107 return render_template('index.html',1108 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1109 state='State_Name :{}'.format(State_Name1),1110 district='District_Name :{}'.format(District_Name1),1111 year='Crop_Year :{}'.format(Crop_Year1),1112 season='Season :{}'.format(Season1),1113 crop='Crop :{}'.format(Crop1),1114 Area='Area :{} ha'.format(Area_in))1115 1116 #Moong1117 if State_Name==5 and Crop==54 or State_Name==6 and Crop==54 or State_Name==3 and Crop==54 or State_Name==30 and Crop==54 or State_Name==1 and Crop==54 or State_Name==4 and Crop==54:1118 prediction=01119 return render_template('index.html',1120 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1121 state='State_Name :{}'.format(State_Name1),1122 district='District_Name :{}'.format(District_Name1),1123 year='Crop_Year :{}'.format(Crop_Year1),1124 season='Season :{}'.format(Season1),1125 crop='Crop :{}'.format(Crop1),1126 Area='Area :{} ha'.format(Area_in))1127 #Onion1128 if State_Name==2 and Crop==94 or State_Name==30 and Crop==94 or State_Name==32 and Crop==94 or State_Name==3 and Crop==94 or State_Name==31 and Crop==94 or State_Name==7 and Crop==94:1129 prediction=01130 return render_template('index.html',1131 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1132 state='State_Name :{}'.format(State_Name1),1133 district='District_Name :{}'.format(District_Name1),1134 year='Crop_Year :{}'.format(Crop_Year1),1135 season='Season :{}'.format(Season1),1136 crop='Crop :{}'.format(Crop1),1137 Area='Area :{} ha'.format(Area_in))1138 #Potato & Rapseed(96)1139 if State_Name==30 and Crop==111 or State_Name==32 and Crop==111 or State_Name==31 and Crop==111 or State_Name==30 and Crop==96 or State_Name==32 and Crop==96:1140 prediction=01141 return render_template('index.html',1142 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1143 state='State_Name :{}'.format(State_Name1),1144 district='District_Name :{}'.format(District_Name1),1145 year='Crop_Year :{}'.format(Crop_Year1),1146 season='Season :{}'.format(Season1),1147 crop='Crop :{}'.format(Crop1),1148 Area='Area :{} ha'.format(Area_in))1149 #Soyabean1150 if State_Name==30 and Crop==108 or State_Name==24 and Crop==108 or State_Name==15 and Crop==108 or State_Name==21 and Crop==108 or State_Name==10 and Crop==108 or State_Name==32 and Crop==108 or State_Name==26 and Crop==108 or State_Name==9 and Crop==108 or State_Name==28 and Crop==108:1151 prediction=01152 return render_template('index.html',1153 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1154 state='State_Name :{}'.format(State_Name1),1155 district='District_Name :{}'.format(District_Name1),1156 year='Crop_Year :{}'.format(Crop_Year1),1157 season='Season :{}'.format(Season1),1158 crop='Crop :{}'.format(Crop1),1159 Area='Area :{} ha'.format(Area_in))1160 #Sugarcane & Urad1161 if State_Name==3 and Crop==121 or State_Name==0 and Crop==121 or State_Name==30 and Crop==67 or State_Name==6 and Crop==67 or State_Name==5 and Crop==67 or State_Name==3 and Crop==67 or State_Name==32 and Crop==67 or State_Name==1 and Crop==67:1162 prediction=01163 return render_template('index.html',1164 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1165 state='State_Name :{}'.format(State_Name1),1166 district='District_Name :{}'.format(District_Name1),1167 year='Crop_Year :{}'.format(Crop_Year1),1168 season='Season :{}'.format(Season1),1169 crop='Crop :{}'.format(Crop1),1170 Area='Area :{} ha'.format(Area_in))1171 #Wheat1172 1173 if State_Name==29 and Crop==119 or State_Name==32 and Crop==119 or State_Name==1 and Crop==119 or State_Name==30 and Crop==119 or State_Name==27 and Crop==119 or State_Name==31 and Crop==119:1174 prediction=01175 return render_template('index.html',1176 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1177 state='State_Name :{}'.format(State_Name1),1178 district='District_Name :{}'.format(District_Name1),1179 year='Crop_Year :{}'.format(Crop_Year1),1180 season='Season :{}'.format(Season1),1181 crop='Crop :{}'.format(Crop1),1182 Area='Area :{} ha'.format(Area_in))1183 #Rice1184 if State_Name==10 and Crop==117 or State_Name==16 and Crop==117 or State_Name==5 and Crop==117 or State_Name==9 and Crop==117 or State_Name==1 and Crop==117 or State_Name==6 and Crop==117 or State_Name==2 and Crop==117:1185 prediction=01186 return render_template('index.html',1187 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1188 state='State_Name :{}'.format(State_Name1),1189 district='District_Name :{}'.format(District_Name1),1190 year='Crop_Year :{}'.format(Crop_Year1),1191 season='Season :{}'.format(Season1),1192 crop='Crop :{}'.format(Crop1),1193 Area='Area :{} ha'.format(Area_in))1194 1195 #Barley1196 1197 if State_Name==0 and Crop==83 or State_Name==1 and Crop==83 or State_Name==2 and Crop==83 or State_Name==4 and Crop==83 or State_Name==5 and Crop==83 or State_Name==6 and Crop==83 or State_Name==7 and Crop==83 or State_Name==9 and Crop==83 or State_Name==10 and Crop==83 or State_Name==13 and Crop==83 or State_Name==18 and Crop==83 or State_Name==19 and Crop==83 or State_Name==20 and Crop==83 or State_Name==22 and Crop==83 or State_Name==24 and Crop==83 or State_Name==27 and Crop==83 or State_Name==28 and Crop==83 or State_Name==29 and Crop==83 or State_Name==30 and Crop==83 or State_Name==31 and Crop==83 or State_Name==32 and Crop==83 :1198 prediction=01199 return render_template('index.html',1200 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1201 state='State_Name :{}'.format(State_Name1),1202 district='District_Name :{}'.format(District_Name1),1203 year='Crop_Year :{}'.format(Crop_Year1),1204 season='Season :{}'.format(Season1),1205 crop='Crop :{}'.format(Crop1),1206 Area='Area :{} ha'.format(Area_in))1207 #Cashewnut1208 1209 if State_Name==0 and Crop==66 or State_Name==1 and Crop==66 or State_Name==2 and Crop==66 or State_Name==3 and Crop==66 or State_Name==6 and Crop==66 or State_Name==7 and Crop==66 or State_Name==8 and Crop==66 or State_Name==11 and Crop==66 or State_Name==13 and Crop==66 or State_Name==14 and Crop==66 or State_Name==15 and Crop==66 or State_Name==16 and Crop==66 or State_Name==17 and Crop==66 or State_Name==21 and Crop==66 or State_Name==23 and Crop==66 or State_Name==26 and Crop==66 or State_Name==31 and Crop==66 :1210 prediction=01211 return render_template('index.html',1212 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1213 state='State_Name :{}'.format(State_Name1),1214 district='District_Name :{}'.format(District_Name1),1215 year='Crop_Year :{}'.format(Crop_Year1),1216 season='Season :{}'.format(Season1),1217 crop='Crop :{}'.format(Crop1),1218 Area='Area :{} ha'.format(Area_in))1219 #castor1220 1221 if State_Name==0 and Crop==79 or State_Name==1 and Crop==79 or State_Name==2 and Crop==79 or State_Name==3 and Crop==79 or State_Name==5 and Crop==79 or State_Name==6 and Crop==79 or State_Name==7 and Crop==79 or State_Name==8 and Crop==79 or State_Name==9 and Crop==79 or State_Name==10 and Crop==79 or State_Name==11 and Crop==79 or State_Name==12 and Crop==79 or State_Name==17 and Crop==79 or State_Name==23 and Crop==79 or State_Name==25 and Crop==79 or State_Name==26 and Crop==79 or State_Name==27 and Crop==79 or State_Name==30 and Crop==79 or State_Name==31 and Crop==79 or State_Name==32 and Crop==79 :1222 prediction=01223 return render_template('index.html',1224 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1225 state='State_Name :{}'.format(State_Name1),1226 district='District_Name :{}'.format(District_Name1),1227 year='Crop_Year :{}'.format(Crop_Year1),1228 season='Season :{}'.format(Season1),1229 crop='Crop :{}'.format(Crop1),1230 Area='Area :{} ha'.format(Area_in))1231 #coconut1232 1233 if State_Name==0 and Crop==122 or State_Name==1 and Crop==122 or State_Name==2 and Crop==122 or State_Name==3 and Crop==122 or State_Name==5 and Crop==122 or State_Name==6 and Crop==122 or State_Name==7 and Crop==122 or State_Name==8 and Crop==122 or State_Name==10 and Crop==122 or State_Name==11 and Crop==122 or State_Name==12 and Crop==122 or State_Name==14 and Crop==122 or State_Name==15 and Crop==122 or State_Name==16 and Crop==122 or State_Name==17 and Crop==122 or State_Name==21 and Crop==122 or State_Name==23 and Crop==122 or State_Name==26 and Crop==122 :1234 prediction=01235 return render_template('index.html',1236 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1237 state='State_Name :{}'.format(State_Name1),1238 district='District_Name :{}'.format(District_Name1),1239 year='Crop_Year :{}'.format(Crop_Year1),1240 season='Season :{}'.format(Season1),1241 crop='Crop :{}'.format(Crop1),1242 Area='Area :{} ha'.format(Area_in))1243 #Coffee1244 1245 if State_Name==0 and Crop==105 or State_Name==1 and Crop==105 or State_Name==2 and Crop==105 or State_Name==3 and Crop==105 or State_Name==4 and Crop==105 or State_Name==5 and Crop==105 or State_Name==6 and Crop==105 or State_Name==7 and Crop==105 or State_Name==8 and Crop==105 or State_Name==9 and Crop==105 or State_Name==10 and Crop==105 or State_Name==11 and Crop==105 or State_Name==12 and Crop==105 or State_Name==14 and Crop==105 or State_Name==15 and Crop==105 or State_Name==16 and Crop==105 or State_Name==17 and Crop==105 or State_Name==19 and Crop==105 or State_Name==20 and Crop==105 or State_Name==21 and Crop==105 or State_Name==22 and Crop==105 or State_Name==23 and Crop==105 or State_Name==25 and Crop==105 or State_Name==26 and Crop==105 or State_Name==27 and Crop==105 or State_Name==30 and Crop==105 or State_Name==31 and Crop==105 :1246 1247 prediction=01248 return render_template('index.html',1249 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1250 state='State_Name :{}'.format(State_Name1),1251 district='District_Name :{}'.format(District_Name1),1252 year='Crop_Year :{}'.format(Crop_Year1),1253 season='Season :{}'.format(Season1),1254 crop='Crop :{}'.format(Crop1),1255 Area='Area :{} ha'.format(Area_in))1256 #CONDIMENTS 1257 1258 if State_Name==0 and Crop==22 or State_Name==1 and Crop==22 or State_Name==2 and Crop==22 or State_Name==3 and Crop==22 or State_Name==4 and Crop==22 or State_Name==5 and Crop==22 or State_Name==7 and Crop==22 or State_Name==8 and Crop==22 or State_Name==9 and Crop==22 or State_Name==11 and Crop==22 or State_Name==13 and Crop==22 or State_Name==15 and Crop==22 or State_Name==27 and Crop==22 or State_Name==30 and Crop==22 or State_Name==31 and Crop==22 or State_Name==32 and Crop==22 :1259 prediction=01260 return render_template('index.html',1261 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1262 state='State_Name :{}'.format(State_Name1),1263 district='District_Name :{}'.format(District_Name1),1264 year='Crop_Year :{}'.format(Crop_Year1),1265 season='Season :{}'.format(Season1),1266 crop='Crop :{}'.format(Crop1),1267 Area='Area :{} ha'.format(Area_in))1268 #Cotton iint 1269 1270 if State_Name==0 and Crop==115 or State_Name==1 and Crop==115 or State_Name==2 and Crop==115 or State_Name==3 and Crop==115 or State_Name==4 and Crop==115 or State_Name==6 and Crop==115 or State_Name==7 and Crop==115 or State_Name==8 and Crop==115 or State_Name==9 and Crop==115 or State_Name==10 and Crop==115 or State_Name==11 and Crop==115 or State_Name==12 and Crop==115 or State_Name==15 and Crop==115 or State_Name==17 and Crop==115 or State_Name==25 and Crop==115 or State_Name==27 and Crop==115 or State_Name==30 and Crop==115 or State_Name==31 and Crop==115 :1271 prediction=01272 return render_template('index.html',1273 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1274 state='State_Name :{}'.format(State_Name1),1275 district='District_Name :{}'.format(District_Name1),1276 year='Crop_Year :{}'.format(Crop_Year1),1277 season='Season :{}'.format(Season1),1278 crop='Crop :{}'.format(Crop1),1279 Area='Area :{} ha'.format(Area_in))1280 #jowar1281 1282 if State_Name==0 and Crop==102 or State_Name==1 and Crop==102 or State_Name==2 and Crop==102 or State_Name==3 and Crop==102 or State_Name==4 and Crop==102 or State_Name==5 and Crop==102 or State_Name==6 and Crop==102 or State_Name==7 and Crop==102 or State_Name==8 and Crop==102 or State_Name==9 and Crop==102 or State_Name==11 and Crop==102 or State_Name==13 and Crop==102 or State_Name==17 and Crop==102 or State_Name==24 and Crop==102 or State_Name==25 and Crop==102 or State_Name==26 and Crop==102 or State_Name==27 and Crop==102 or State_Name==30 and Crop==102 or State_Name==31 and Crop==102 or State_Name==32 and Crop==102 :1283 prediction=01284 return render_template('index.html',1285 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1286 state='State_Name :{}'.format(State_Name1),1287 district='District_Name :{}'.format(District_Name1),1288 year='Crop_Year :{}'.format(Crop_Year1),1289 season='Season :{}'.format(Season1),1290 crop='Crop :{}'.format(Crop1),1291 Area='Area :{} ha'.format(Area_in))1292 #sunflower1293 1294 if State_Name==0 and Crop==65 or State_Name==1 and Crop==65 or State_Name==3 and Crop==65 or State_Name==5 and Crop==65 or State_Name==6 and Crop==65 or State_Name==7 and Crop==65 or State_Name==8 and Crop==65 or State_Name==9 and Crop==65 or State_Name==11 and Crop==65 or State_Name==14 and Crop==65 or State_Name==16 and Crop==65 or State_Name==17 and Crop==65 or State_Name==19 and Crop==65 or State_Name==24 and Crop==65 or State_Name==27 and Crop==65 or State_Name==30 and Crop==65 or State_Name==31 and Crop==65 or State_Name==32 and Crop==65 :1295 prediction=01296 return render_template('index.html',1297 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1298 state='State_Name :{}'.format(State_Name1),1299 district='District_Name :{}'.format(District_Name1),1300 year='Crop_Year :{}'.format(Crop_Year1),1301 season='Season :{}'.format(Season1),1302 crop='Crop :{}'.format(Crop1),1303 Area='Area :{} ha'.format(Area_in))1304 #Tea1305 1306 if State_Name==0 and Crop==70 or State_Name==1 and Crop==70 or State_Name==3 and Crop==70 or State_Name==5 and Crop==70 or State_Name==6 and Crop==70 or State_Name==7 and Crop==70 or State_Name==8 and Crop==70 or State_Name==11 and Crop==70 or State_Name==12 and Crop==70 or State_Name==13 and Crop==70 or State_Name==14 and Crop==70 or State_Name==16 and Crop==70 or State_Name==17 and Crop==70 or State_Name==19 and Crop==70 or State_Name==20 and Crop==70 or State_Name==21 and Crop==70 or State_Name==22 and Crop==70 or State_Name==23 and Crop==70 or State_Name==26 and Crop==70 or State_Name==27 and Crop==70 or State_Name==29 and Crop==70 or State_Name==30 and Crop==70 or State_Name==31 and Crop==70 :1307 prediction=01308 return render_template('index.html',1309 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1310 state='State_Name :{}'.format(State_Name1),1311 district='District_Name :{}'.format(District_Name1),1312 year='Crop_Year :{}'.format(Crop_Year1),1313 season='Season :{}'.format(Season1),1314 crop='Crop :{}'.format(Crop1),1315 Area='Area :{} ha'.format(Area_in))1316 1317 1318 #Tobacco1319 1320 if State_Name==0 and Crop==78 or State_Name==2 and Crop==78 or State_Name==3 and Crop==78 or State_Name==4 and Crop==78 or State_Name==6 and Crop==78 or State_Name==7 and Crop==78 or State_Name==8 and Crop==78 or State_Name==9 and Crop==78 or State_Name==11 and Crop==78 or State_Name==17 and Crop==78 or State_Name==21 and Crop==78 or State_Name==26 and Crop==78 or State_Name==27 and Crop==78 or State_Name==29 and Crop==78 or State_Name==30 and Crop==78 or State_Name==31 and Crop==78 :1321 prediction=01322 return render_template('index.html',1323 prediction_text='The predicted production of the crop is {} tonne as selected crop is not cultivated in this state'.format(prediction),1324 state='State_Name :{}'.format(State_Name1),1325 district='District_Name :{}'.format(District_Name1),1326 year='Crop_Year :{}'.format(Crop_Year1),1327 season='Season :{}'.format(Season1),1328 crop='Crop :{}'.format(Crop1),1329 Area='Area :{} ha'.format(Area_in))1330 1331 1332 1333 1334 1335 1336 else:1337 return render_template('index.html',prediction_text='The predicted production of the selected crop is {} tonne'.format(prediction),1338 state='State_Name :{}'.format(State_Name1),1339 district='District_Name :{}'.format(District_Name1),1340 year='Crop_Year :{}'.format(Crop_Year1),1341 season='Season :{}'.format(Season1),1342 crop='Crop :{}'.format(Crop1),1343 crop_div='Description of Crop :{}'.format(Crop1),1344 crop_out=crop2,1345 Area='Area :{} ha'.format(Area_in),1346 #prediction_text1='crop production prediction1 {} tonne'.format(prediction1),1347 #prediction_text2='crop production prediction2 {} tonne'.format(prediction2),1348 #prediction_text3='crop production prediction3 {} tonne'.format(prediction3),1349 #prediction_text4='crop production prediction4 {} tonne'.format(prediction4),1350 prediction_text1=prediction1,1351 prediction_text2=prediction2,1352 prediction_text3=prediction,1353 prediction_text4=prediction3,1354 prediction_text5=prediction4,1355 prediction_Area=prediction,1356 prediction_Area1=prediction_Area1,1357 prediction_Area2=prediction_Area2,1358 prediction_Area3=prediction_Area3,1359 prediction_Area4=prediction_Area4,1360 1361 Area_enter=Area,1362 Area1=Area1,1363 Area2=Area2,1364 Area3=Area3,1365 Area4=Area4,1366 crop1=Crop_Year7,1367 crop2=Crop_Year8,1368 crop3=Crop_Year1,1369 crop4=Crop_Year9,1370 crop5=Crop_Year10)1371 #crop2='Crop_Year :{}'.format(Crop_Year8),1372 #crop3='Crop_Year :{}'.format(Crop_Year9),1373 #crop4='Crop_Year :{}'.format(Crop_Year10))1374# In[12]:1375if __name__=="__main__":1376 app.run(debug=True)...
transformer_test_data.py
Source:transformer_test_data.py
...31 def reorientate(self):32 self.calls["reorientate"] += 133 def resize(self, width, height):34 self.calls["resize"].append({"width": width, "height": height})35 def crop(self, left, top, right, bottom):36 self.calls["crop"].append(37 {"left": left, "top": top, "right": right, "bottom": bottom}38 )39 def flip_horizontally(self):40 self.calls["horizontal_flip"] += 141 def flip_vertically(self):42 self.calls["vertical_flip"] += 143 def get_proportional_width(self, new_height):44 width, height = self.size45 return float(new_height) * width / height46 def get_proportional_height(self, new_width):47 width, height = self.size48 return float(new_width) * height / width49 def focus(self, focal_points):...
image_operations.py
Source:image_operations.py
...94 rect = rect.move_to_cover(focal_point)95 # Don't allow the crop box to go over the image boundary96 rect = rect.move_to_clamp(Rect(0, 0, image_width, image_height))97 # Crop!98 willow.crop(rect.round())99 # Get scale for resizing100 # The scale should be the same for both the horizontal and101 # vertical axes102 aftercrop_width, aftercrop_height = willow.get_size()103 scale = self.width / aftercrop_width104 # Only resize if the image is too big105 if scale < 1.0:106 # Resize!107 willow.resize((self.width, self.height))108class MinMaxOperation(Operation):109 def construct(self, size):110 # Get width and height111 width_str, height_str = size.split('x')112 self.width = int(width_str)...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!