Update app.py
Browse files
app.py
CHANGED
@@ -85,7 +85,7 @@ PARAMS = {
|
|
85 |
|
86 |
@app.route('/')
|
87 |
def index():
|
88 |
-
# Read query parameters
|
89 |
crop = request.args.get('crop', '')
|
90 |
pest = request.args.get('pest', '')
|
91 |
year = request.args.get('year', '')
|
@@ -94,14 +94,9 @@ def index():
|
|
94 |
|
95 |
image_url = ""
|
96 |
if crop and pest and year and week and param:
|
97 |
-
#
|
98 |
-
|
99 |
-
|
100 |
-
if crop in PEST_MAPPING and pest in PEST_MAPPING[crop]:
|
101 |
-
ext_pest = PEST_MAPPING[crop][pest]
|
102 |
-
|
103 |
-
# Build image URL using external values
|
104 |
-
base_url = f"http://www.icar-crida.res.in:8080/naip/gisimages/{ext_crop}/{year}/{ext_pest}_"
|
105 |
image_url = f"{base_url}{param}{week}.jpg"
|
106 |
|
107 |
return render_template('index.html',
|
|
|
85 |
|
86 |
@app.route('/')
|
87 |
def index():
|
88 |
+
# Read query parameters (if provided)
|
89 |
crop = request.args.get('crop', '')
|
90 |
pest = request.args.get('pest', '')
|
91 |
year = request.args.get('year', '')
|
|
|
94 |
|
95 |
image_url = ""
|
96 |
if crop and pest and year and week and param:
|
97 |
+
# Build image URL using the pattern:
|
98 |
+
# http://www.icar-crida.res.in:8080/naip/gisimages/{CROP}/{YEAR}/{PEST}_{PARAM}{WEEK}.jpg
|
99 |
+
base_url = f"http://www.icar-crida.res.in:8080/naip/gisimages/{crop}/{year}/{pest}_"
|
|
|
|
|
|
|
|
|
|
|
100 |
image_url = f"{base_url}{param}{week}.jpg"
|
101 |
|
102 |
return render_template('index.html',
|