sikeaditya commited on
Commit
c2d750c
·
verified ·
1 Parent(s): feaee89

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -41,7 +41,7 @@ def get_soil_report():
41
  class_response = requests.get(
42
  "https://rest.isric.org/soilgrids/v2.0/classification/query",
43
  params={"lon": lon, "lat": lat, "number_classes": 5},
44
- headers=headers
45
  )
46
  class_response.raise_for_status()
47
  class_data = class_response.json()
@@ -49,7 +49,7 @@ def get_soil_report():
49
  prop_response = requests.get(
50
  "https://rest.isric.org/soilgrids/v2.0/properties/query",
51
  params={"lon": lon, "lat": lat, "property": list(PARAM_MAP.keys()), "depth": "5-15cm", "value": "mean"},
52
- headers=headers
53
  )
54
  prop_response.raise_for_status()
55
  prop_data = prop_response.json()
@@ -89,7 +89,7 @@ def analyze_soil():
89
  JSON Structure to follow: {{"soilType": "Primary soil type", "generalInsights": ["Insight 1", "Insight 2"], "parameters": [{{"parameter": "Parameter Name", "value": "Value with Unit", "range": "Low/Normal/High", "comment": "Brief comment."}}], "cropRecommendations": [{{"crop": "Crop Name", "reason": "Brief reason."}}], "managementRecommendations": {{"fertilization": "Recommendation.", "irrigation": "Recommendation."}}}}
90
  """
91
 
92
- genai.configure(api_key=api_key)
93
 
94
  models_to_try = ['gemini-2.5-flash', 'gemini-2.0-flash', 'gemini-1.5-flash']
95
  analysis_json = None
 
41
  class_response = requests.get(
42
  "https://rest.isric.org/soilgrids/v2.0/classification/query",
43
  params={"lon": lon, "lat": lat, "number_classes": 5},
44
+ headers=headers , timeout=120
45
  )
46
  class_response.raise_for_status()
47
  class_data = class_response.json()
 
49
  prop_response = requests.get(
50
  "https://rest.isric.org/soilgrids/v2.0/properties/query",
51
  params={"lon": lon, "lat": lat, "property": list(PARAM_MAP.keys()), "depth": "5-15cm", "value": "mean"},
52
+ headers=headers , timeout=120
53
  )
54
  prop_response.raise_for_status()
55
  prop_data = prop_response.json()
 
89
  JSON Structure to follow: {{"soilType": "Primary soil type", "generalInsights": ["Insight 1", "Insight 2"], "parameters": [{{"parameter": "Parameter Name", "value": "Value with Unit", "range": "Low/Normal/High", "comment": "Brief comment."}}], "cropRecommendations": [{{"crop": "Crop Name", "reason": "Brief reason."}}], "managementRecommendations": {{"fertilization": "Recommendation.", "irrigation": "Recommendation."}}}}
90
  """
91
 
92
+ genai.configure(api_key="AIzaSyDkiYr-eSkqIXpZ1fHlik_YFsFtfQoFi0w")
93
 
94
  models_to_try = ['gemini-2.5-flash', 'gemini-2.0-flash', 'gemini-1.5-flash']
95
  analysis_json = None