omm7 commited on
Commit
0156d82
·
verified ·
1 Parent(s): aba87c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -10,9 +10,10 @@ preprocessor = joblib.load('preprocessor.pkl')
10
 
11
  app = Flask(__name__)
12
 
13
- @app.before_first_request
14
- def startup_message():
15
- print(f"[{datetime.now()}] 🚀 Backend server is up and running on port {os.environ.get('PORT', 5000)}!")
 
16
 
17
  @app.route('/predict', methods=['POST'])
18
  def predict():
@@ -36,5 +37,5 @@ def predict():
36
 
37
  if __name__ == '__main__':
38
  port = int(os.environ.get("PORT", 5000))
39
- print(f"[{datetime.now()}] Starting Flask server...")
40
  app.run(host='0.0.0.0', port=port)
 
10
 
11
  app = Flask(__name__)
12
 
13
+ # Health check endpoint
14
+ @app.route('/health', methods=['GET'])
15
+ def health_check():
16
+ return jsonify({"status": "ok", "message": "Backend is running"}), 200
17
 
18
  @app.route('/predict', methods=['POST'])
19
  def predict():
 
37
 
38
  if __name__ == '__main__':
39
  port = int(os.environ.get("PORT", 5000))
40
+ print(f"[{datetime.now()}] 🚀 Backend server is starting on port {port}...")
41
  app.run(host='0.0.0.0', port=port)