josiauhlol commited on
Commit
863671d
·
1 Parent(s): c00b7af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -40,7 +40,7 @@ def check_cc(n):
40
  digits[i] *= 2
41
 
42
  total = sum(digits)
43
- return "Valid" if total % 2 == 0 else "Invalid"
44
 
45
 
46
  with gr.Blocks(title="Josiah's Gradio Playground") as playground:
@@ -59,7 +59,7 @@ with gr.Blocks(title="Josiah's Gradio Playground") as playground:
59
  num = gr.Textbox("CC Number (DO NOT USE MALICIOUSLY)")
60
  valid = gr.Textbox("Is valid (DO NOT USE MALICIOUSLY)")
61
  with gr.Row():
62
- validate = gr.Button("Validate")
63
  gr.ClearButton([num, valid])
64
  validate.click(fn=check_cc, inputs=num,outputs=valid)
65
 
 
40
  digits[i] *= 2
41
 
42
  total = sum(digits)
43
+ return "Valid" if total % 2 == 0 and len(digits) == 16 else "Invalid"
44
 
45
 
46
  with gr.Blocks(title="Josiah's Gradio Playground") as playground:
 
59
  num = gr.Textbox("CC Number (DO NOT USE MALICIOUSLY)")
60
  valid = gr.Textbox("Is valid (DO NOT USE MALICIOUSLY)")
61
  with gr.Row():
62
+ validate = gr.Button("Validate", variant="primary")
63
  gr.ClearButton([num, valid])
64
  validate.click(fn=check_cc, inputs=num,outputs=valid)
65