80cols commited on
Commit
a616932
·
verified ·
1 Parent(s): 1ab0767

add pre-completion data Fraud or noFraud

Browse files
Files changed (1) hide show
  1. app.py +43 -1
app.py CHANGED
@@ -127,10 +127,23 @@ with demo:
127
 
128
  gr.Markdown(
129
  "## Step 2: Make your purchase\n\n"
130
- """ 🛍️ It's time to shop! To simulate your latest purchase, please provide the details of your most recent transaction.
 
 
 
131
  """
132
  )
133
 
 
 
 
 
 
 
 
 
 
 
134
  with gr.Row():
135
  with gr.Column():
136
  distance_home = gr.Slider(
@@ -174,6 +187,35 @@ with demo:
174
  info="Check if you made your purchase online"
175
  )
176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  with gr.Row():
178
  with gr.Column(scale=2):
179
  encrypt_button_applicant = gr.Button("Encrypt the inputs and send to server.")
 
127
 
128
  gr.Markdown(
129
  "## Step 2: Make your purchase\n\n"
130
+ """
131
+ 🛍️ It's time to shop! To simulate your latest purchase, please provide the details of your most recent transaction.
132
+
133
+ If you don't have an idea, you can pre-fill with an example of fraud or non-fraud.
134
  """
135
  )
136
 
137
+ def prefill_fraud():
138
+ return 34, 50, 3, False, False, False, True
139
+
140
+ def prefill_no_fraud():
141
+ return 12, 2, 0.7, True, False, True, False
142
+
143
+ with gr.Row():
144
+ prefill_button = gr.Button("Exemple Fraud")
145
+ prefill_button_no = gr.Button("Exemple No-Fraud")
146
+
147
  with gr.Row():
148
  with gr.Column():
149
  distance_home = gr.Slider(
 
187
  info="Check if you made your purchase online"
188
  )
189
 
190
+
191
+ prefill_button.click(
192
+ fn=prefill_fraud,
193
+ inputs=[],
194
+ outputs=[
195
+ distance_home,
196
+ distance_last,
197
+ ratio,
198
+ repeat_retailer,
199
+ used_chip,
200
+ used_pin_number,
201
+ online
202
+ ]
203
+ )
204
+
205
+ prefill_button_no.click(
206
+ fn=prefill_no_fraud,
207
+ inputs=[],
208
+ outputs=[
209
+ distance_home,
210
+ distance_last,
211
+ ratio,
212
+ repeat_retailer,
213
+ used_chip,
214
+ used_pin_number,
215
+ online
216
+ ]
217
+ )
218
+
219
  with gr.Row():
220
  with gr.Column(scale=2):
221
  encrypt_button_applicant = gr.Button("Encrypt the inputs and send to server.")