josiauhlol commited on
Commit
c00b7af
·
1 Parent(s): 8d18a89

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -4
app.py CHANGED
@@ -30,19 +30,37 @@ def txtRouletteHandler(x, y):
30
  return letterize(x)
31
  elif (rn == 2):
32
  return flip_text(x)
33
- else
34
  return flip_text(x)
35
 
 
 
 
 
 
 
 
 
 
 
36
  with gr.Blocks(title="Josiah's Gradio Playground") as playground:
37
  gr.Markdown("# Josiah's Gradio Playground")
38
- gr.Markdown("Playing around with Gradio.")
39
  with gr.Tab("Tabs within Tabs"):
40
  with gr.Tab("1. first"):
41
  gr.Markdown("you're on 1")
42
  with gr.Tab("2. third"):
43
  gr.Markdown("you're on second")
44
  with gr.Tab("Text Roulette"):
45
- gr.ChatInterface(txtRouletteHandler)
46
-
 
 
 
 
 
 
 
 
47
 
48
  playground.launch()
 
30
  return letterize(x)
31
  elif (rn == 2):
32
  return flip_text(x)
33
+ else:
34
  return flip_text(x)
35
 
36
+ def check_cc(n):
37
+
38
+ digits = [int(d) for d in str(n)]
39
+ for i in range(1, len(digits), 2):
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:
47
  gr.Markdown("# Josiah's Gradio Playground")
48
+ gr.Markdown("Playing around with Gradio. Note that tabs marked as ⚠️ should not be used for malicious purposes.")
49
  with gr.Tab("Tabs within Tabs"):
50
  with gr.Tab("1. first"):
51
  gr.Markdown("you're on 1")
52
  with gr.Tab("2. third"):
53
  gr.Markdown("you're on second")
54
  with gr.Tab("Text Roulette"):
55
+ gr.ChatInterface(fn=txtRouletteHandler, examples=["Hello from USA!", "How is your day?", "skcus teliot idibiks"])
56
+ with gr.Tab("⚠️ CC Validator"):
57
+ gr.Markdown("# THIS WAS NOT MEANT FOR MALICIOUS PURPOSES!")
58
+ gr.Markdown("This is meant to be a fun tool to use.")
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
 
66
  playground.launch()