Update app.py
Browse files
app.py
CHANGED
@@ -71,7 +71,7 @@ def predict(location_name,lat, lon):
|
|
71 |
## Coordinate
|
72 |
cord_df = pd.DataFrame({"Latitude":[lat],
|
73 |
"Longitude":[lon]})
|
74 |
-
print("==================== cord_df SHAPE", cord_df.shape)
|
75 |
## PCA dimension reduction
|
76 |
# later reload the pickle file
|
77 |
sdc_reload = pk.load(open("data/sdc.pkl",'rb'))
|
@@ -82,7 +82,7 @@ def predict(location_name,lat, lon):
|
|
82 |
principalComponents = pca_reload .transform(X_pca)
|
83 |
principalDf = pd.DataFrame(data =principalComponents[:,:4],
|
84 |
columns = ["PC1","PC2","PC3","PC4"])
|
85 |
-
print("==================== principalDf SHAPE", principalDf.shape)
|
86 |
|
87 |
# vegetation index calculation
|
88 |
X = indices(X)
|
@@ -90,11 +90,11 @@ def predict(location_name,lat, lon):
|
|
90 |
tab = list(range(12))
|
91 |
X_index = X.drop(X.iloc[:,tab],axis=1)
|
92 |
|
93 |
-
print("=============SHAPE1",X_index.shape)
|
94 |
|
95 |
# Create predictive features
|
96 |
X_final =pd.concat([cord_df,principalDf,X_index],axis=1)
|
97 |
-
print("=============SHAPE2",X_final.shape)
|
98 |
|
99 |
# load the model from disk
|
100 |
filename = "data/finalized_model3.sav"
|
|
|
71 |
## Coordinate
|
72 |
cord_df = pd.DataFrame({"Latitude":[lat],
|
73 |
"Longitude":[lon]})
|
74 |
+
#print("==================== cord_df SHAPE", cord_df.shape)
|
75 |
## PCA dimension reduction
|
76 |
# later reload the pickle file
|
77 |
sdc_reload = pk.load(open("data/sdc.pkl",'rb'))
|
|
|
82 |
principalComponents = pca_reload .transform(X_pca)
|
83 |
principalDf = pd.DataFrame(data =principalComponents[:,:4],
|
84 |
columns = ["PC1","PC2","PC3","PC4"])
|
85 |
+
#print("==================== principalDf SHAPE", principalDf.shape)
|
86 |
|
87 |
# vegetation index calculation
|
88 |
X = indices(X)
|
|
|
90 |
tab = list(range(12))
|
91 |
X_index = X.drop(X.iloc[:,tab],axis=1)
|
92 |
|
93 |
+
#print("=============SHAPE1",X_index.shape)
|
94 |
|
95 |
# Create predictive features
|
96 |
X_final =pd.concat([cord_df,principalDf,X_index],axis=1)
|
97 |
+
#print("=============SHAPE2",X_final.shape)
|
98 |
|
99 |
# load the model from disk
|
100 |
filename = "data/finalized_model3.sav"
|