Update app.py
Browse files
app.py
CHANGED
|
@@ -21,14 +21,19 @@ import rasterio
|
|
| 21 |
from rasterio.transform import xy
|
| 22 |
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
try:
|
| 28 |
-
ee.Initialize(
|
| 29 |
-
print("Earth Engine initialized
|
| 30 |
except Exception as e:
|
| 31 |
-
print(f"
|
| 32 |
|
| 33 |
# Define crop season dictionary
|
| 34 |
crop_season_dict = {
|
|
|
|
| 21 |
from rasterio.transform import xy
|
| 22 |
|
| 23 |
|
| 24 |
+
# Path to your JSON key
|
| 25 |
+
KEY_PATH = "gee-service-key.json" # or full path if not in the same directory
|
| 26 |
+
|
| 27 |
+
# Email from your service account JSON file
|
| 28 |
+
SERVICE_ACCOUNT = "gee-service@artful-striker-466710-b3.iam.gserviceaccount.com"
|
| 29 |
+
|
| 30 |
+
credentials = ee.ServiceAccountCredentials(SERVICE_ACCOUNT, KEY_PATH)
|
| 31 |
|
| 32 |
try:
|
| 33 |
+
ee.Initialize(credentials)
|
| 34 |
+
print("✅ Earth Engine initialized with service account.")
|
| 35 |
except Exception as e:
|
| 36 |
+
print(f"❌ Initialization failed: {e}")
|
| 37 |
|
| 38 |
# Define crop season dictionary
|
| 39 |
crop_season_dict = {
|