Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +5 -5
src/streamlit_app.py
CHANGED
|
@@ -46,13 +46,13 @@ input_df = pd.DataFrame(input_data)
|
|
| 46 |
|
| 47 |
# Custom transformer to replace 'reg' with 'Regular' in Product_Sugar_Content
|
| 48 |
class SugarContentReplacer(BaseEstimator, TransformerMixin):
|
| 49 |
-
def fit(self,
|
| 50 |
return self
|
| 51 |
|
| 52 |
-
def transform(self,
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
return
|
| 56 |
|
| 57 |
# Add get_feature_names_out method
|
| 58 |
def get_feature_names_out(self, input_features=None):
|
|
|
|
| 46 |
|
| 47 |
# Custom transformer to replace 'reg' with 'Regular' in Product_Sugar_Content
|
| 48 |
class SugarContentReplacer(BaseEstimator, TransformerMixin):
|
| 49 |
+
def fit(self, input_df, y=None):
|
| 50 |
return self
|
| 51 |
|
| 52 |
+
def transform(self, input_df):
|
| 53 |
+
input_df = input_df.copy()
|
| 54 |
+
input_df['Product_Sugar_Content'] = input_df['Product_Sugar_Content'].replace('reg', 'Regular')
|
| 55 |
+
return input_df
|
| 56 |
|
| 57 |
# Add get_feature_names_out method
|
| 58 |
def get_feature_names_out(self, input_features=None):
|