Spaces:
Sleeping
Sleeping
redeploy
Browse files- prediction.py +6 -2
prediction.py
CHANGED
|
@@ -21,10 +21,14 @@ def get_user_input(numeric_columns, categorical_columns):
|
|
| 21 |
if col in categorical_columns:
|
| 22 |
inputs[col] = st.selectbox(col, [0, 1])
|
| 23 |
else:
|
| 24 |
-
#
|
| 25 |
default_val = np.expm1(50.0) if col != 'time' else 50.0
|
| 26 |
inputs[col] = np.log1p(st.number_input(col, value=default_val))
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
def main():
|
| 30 |
st.title("Prediksi Gagal Jantung")
|
|
|
|
| 21 |
if col in categorical_columns:
|
| 22 |
inputs[col] = st.selectbox(col, [0, 1])
|
| 23 |
else:
|
| 24 |
+
# Using np.expm1 to reverse the log transformation for display and input
|
| 25 |
default_val = np.expm1(50.0) if col != 'time' else 50.0
|
| 26 |
inputs[col] = np.log1p(st.number_input(col, value=default_val))
|
| 27 |
+
user_df = pd.DataFrame([inputs])
|
| 28 |
+
|
| 29 |
+
# Ensure the columns are in the expected order
|
| 30 |
+
return user_df[numeric_columns + categorical_columns]
|
| 31 |
+
|
| 32 |
|
| 33 |
def main():
|
| 34 |
st.title("Prediksi Gagal Jantung")
|