Spaces:
Sleeping
Sleeping
Commit ·
ee78942
1
Parent(s): ffa1e68
df_observed
Browse files- src/streamlit_app.py +8 -4
src/streamlit_app.py
CHANGED
|
@@ -74,6 +74,8 @@ s3 = boto3.client(
|
|
| 74 |
obj = s3.get_object(Bucket="mygeodechet", Key="df_dummies_2019.csv")
|
| 75 |
df = pd.read_csv(obj['Body']).drop(columns=["Unnamed: 0"], errors="ignore")
|
| 76 |
|
|
|
|
|
|
|
| 77 |
|
| 78 |
# # Chargement des données
|
| 79 |
# df = pd.read_csv("https://mygeodechet.s3.eu-west-3.amazonaws.com/df_dummies_2019.csv").drop(columns=["Unnamed: 0"], errors="ignore")
|
|
@@ -190,11 +192,13 @@ with chart_col:
|
|
| 190 |
with open(path, "rb") as f:
|
| 191 |
model = pickle.load(f)
|
| 192 |
|
| 193 |
-
expected_cols = model.model.exog_names
|
| 194 |
-
if "const" in expected_cols and "const" not in input_df_complete.columns:
|
| 195 |
-
|
|
|
|
|
|
|
|
|
|
| 196 |
|
| 197 |
-
prediction = max(0, model.predict(input_df_complete[expected_cols]).iloc[0])
|
| 198 |
valeurs_predites.append(prediction)
|
| 199 |
labels.append(typologie)
|
| 200 |
|
|
|
|
| 74 |
obj = s3.get_object(Bucket="mygeodechet", Key="df_dummies_2019.csv")
|
| 75 |
df = pd.read_csv(obj['Body']).drop(columns=["Unnamed: 0"], errors="ignore")
|
| 76 |
|
| 77 |
+
obj_obs = s3.get_object(Bucket="mygeodechet", Key="data_wip_v5.xlsx")
|
| 78 |
+
observed_df = pd.read_excel(obj_obs['Body'])
|
| 79 |
|
| 80 |
# # Chargement des données
|
| 81 |
# df = pd.read_csv("https://mygeodechet.s3.eu-west-3.amazonaws.com/df_dummies_2019.csv").drop(columns=["Unnamed: 0"], errors="ignore")
|
|
|
|
| 192 |
with open(path, "rb") as f:
|
| 193 |
model = pickle.load(f)
|
| 194 |
|
| 195 |
+
# expected_cols = model.model.exog_names
|
| 196 |
+
# if "const" in expected_cols and "const" not in input_df_complete.columns:
|
| 197 |
+
# input_df_complete["const"] = 1.0
|
| 198 |
+
|
| 199 |
+
# prediction = max(0, model.predict(input_df_complete[expected_cols]).iloc[0])
|
| 200 |
+
prediction = max(0, model.predict(input_df_complete).iloc[0])
|
| 201 |
|
|
|
|
| 202 |
valeurs_predites.append(prediction)
|
| 203 |
labels.append(typologie)
|
| 204 |
|