esteele commited on
Commit
025c146
·
verified ·
1 Parent(s): 65b7e7f

add healthcheck func

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -5,6 +5,13 @@ import pandas as pd
5
  model = joblib.load("best_random_forest_model.joblib")
6
 
7
 
 
 
 
 
 
 
 
8
  def predict_loan_status(
9
  loan_original_amount,
10
  credit_score_range_lower,
@@ -64,6 +71,13 @@ description = (
64
  "Enter the details of the loan to check the status of the loan."
65
  )
66
  gr.Interface(
 
 
 
 
 
 
 
67
  fn=predict_loan_status,
68
  inputs=inputs,
69
  outputs=outputs,
 
5
  model = joblib.load("best_random_forest_model.joblib")
6
 
7
 
8
+ def keep_alive():
9
+ try:
10
+ predict_loan_status(10000, 10, 600, 250, 5000)
11
+ return "ok"
12
+ except Exception as e:
13
+ return f"error: {str(e)}"
14
+
15
  def predict_loan_status(
16
  loan_original_amount,
17
  credit_score_range_lower,
 
71
  "Enter the details of the loan to check the status of the loan."
72
  )
73
  gr.Interface(
74
+ fn=keep_alive,
75
+ inputs=[],
76
+ outputs="text",
77
+ api_name="keep_alive"
78
+ )
79
+ gr.Interface(
80
+ # fn=keep_alive,
81
  fn=predict_loan_status,
82
  inputs=inputs,
83
  outputs=outputs,