romanbredehoft-zama commited on
Commit
0e9fc02
β€’
1 Parent(s): 04d1e2c

Add prediction message

Browse files
Files changed (3) hide show
  1. app.py +1 -1
  2. backend.py +3 -2
  3. development.py +8 -0
app.py CHANGED
@@ -142,7 +142,7 @@ with demo:
142
  decrypt_button = gr.Button("Decrypt the output")
143
 
144
  prediction_output = gr.Textbox(
145
- label="Credit card approval high risk: ", max_lines=1, interactive=False
146
  )
147
 
148
  # Button generate the keys
 
142
  decrypt_button = gr.Button("Decrypt the output")
143
 
144
  prediction_output = gr.Textbox(
145
+ label="Prediction", max_lines=1, interactive=False
146
  )
147
 
148
  # Button generate the keys
backend.py CHANGED
@@ -419,6 +419,7 @@ def decrypt_output(client_id):
419
  output_proba = client.deserialize_decrypt_dequantize(encrypted_output_proba)
420
 
421
  # Determine the predicted class
422
- output = numpy.argmax(output_proba, axis=1)
423
 
424
- return output
 
 
419
  output_proba = client.deserialize_decrypt_dequantize(encrypted_output_proba)
420
 
421
  # Determine the predicted class
422
+ output = numpy.argmax(output_proba, axis=1).squeeze()
423
 
424
+ # A "0" output means approving the credit card has low risk, while "1" is high risk
425
+ return "Credit card has been approved βœ…" if output == 0 else "Credit card has been rejected ❌"
development.py CHANGED
@@ -24,6 +24,14 @@ def get_processed_multi_inputs(data):
24
 
25
  print("Load and pre-process the data")
26
 
 
 
 
 
 
 
 
 
27
  data = pandas.read_csv(DATA_PATH, encoding="utf-8")
28
 
29
  # Define input and target data
 
24
 
25
  print("Load and pre-process the data")
26
 
27
+ # Original data set can be found here :
28
+ # https://www.kaggle.com/datasets/rikdifos/credit-card-approval-prediction/data
29
+ # It then has been cleaned using the following notebook :
30
+ # https://www.kaggle.com/code/samuelcortinhas/credit-cards-data-cleaning
31
+ # A few additional pre-processing steps has bee applied to this data set as well :
32
+ # - "ID" column has been removed
33
+ # - "Total_income" values have been multiplied by 0.14 to make its median value match France's
34
+ # annual salary one from 2023 (in euros)
35
  data = pandas.read_csv(DATA_PATH, encoding="utf-8")
36
 
37
  # Define input and target data