diff --git a/app.py b/app.py index 89e0dc9..1e4df7a 100644 --- a/app.py +++ b/app.py @@ -3,6 +3,14 @@ import numpy as np import joblib from sklearn.metrics import roc_curve +import logging + +# Configure logging +logging.basicConfig( + filename='app.log', + level=logging.INFO, + format='%(asctime)s - %(levelname)s - %(message)s' +) xgb_model = joblib.load("pkl_files/xgboost_model.pkl") scaler = joblib.load("pkl_files/scaler.pkl") @@ -97,4 +105,5 @@ def investment_strategy(predicted, vix, usgg3m, gold_threshold=1500): st.line_chart(portfolio_growth) except Exception as e: - st.error(f"An error occurred: {e}") + logging.error(f"Error in prediction: {str(e)}", exc_info=True) + st.error("An error occurred while processing your request. Please check the input values.") diff --git a/config.py b/config.py new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/config.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tests/test_app.py b/tests/test_app.py new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/tests/test_app.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/utils.py b/utils.py new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/utils.py @@ -0,0 +1 @@ + \ No newline at end of file