Spaces:
Runtime error
Runtime error
Update app.py
Browse files214 unmodified lines215216217218219220221222223224225226227228229230214 unmodified linesdata["風險等級"] = data["預測機率"].apply(categorize_risk)st.dataframe(data[["年齡", "性別", "預測機率", "風險等級"]])def to_excel(df):output = BytesIO()with pd.ExcelWriter(output, engine="xlsxwriter") as writer:df.to_excel(writer, index=False)output.seek(0)return outputst.download_button("下載全部分級結果", data=to_excel(data), file_name="all_fallrisk_pred.xlsx")st.subheader("📝 衛教建議")categorize_risk = create_categorize_risk_fn(0.75, 0.4)result_df = X_test.copy()result_df["實際"] = y_test.values214 unmodified lines215216217218219220221222223224225226227228229230214 unmodified linesdata["風險等級"] = data["預測機率"].apply(categorize_risk)st.dataframe(data[["年齡", "性別", "預測機率", "風險等級"]])def to_excel(df):output = BytesIO()with pd.ExcelWriter(output, engine="xlsxwriter") as writer:df.to_excel(writer, index=False)output.seek(0)return outputst.download_button("下載全部分級結果", data=to_excel(data), file_name="all_fallrisk_pred.xlsx")st.subheader("📝 衛教建議")categorize_risk = create_categorize_risk_fn(0.75, 0.4)result_df = X_test.copy()result_df["實際"] = y_test.values
app.py+3-3