tbitai commited on
Commit
f409800
·
verified ·
1 Parent(s): 272aa6d

Fix missing new arguments from examples

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -38,6 +38,8 @@ def predict_bayes(text, intr_threshold, unbiased=False):
38
  interesting_probs = get_interesting_probs(probs, intr_threshold)
39
  return combine(interesting_probs)
40
 
 
 
41
  MODELS = [
42
  BAYES := "Bayes Enron1 spam",
43
  ]
@@ -51,16 +53,18 @@ demo = gr.Interface(
51
  inputs=[
52
  gr.Dropdown(choices=MODELS, value=BAYES, label="Model"),
53
  gr.Checkbox(label="Unbias", info="Correct Graham's bias?"),
54
- gr.Slider(minimum=1, maximum=20, step=1, value=15, label="Interestingness threshold",
55
- info="How many of the most interesting words to select in the probability calculation?"),
 
56
  gr.TextArea(label="Email"),
57
  ],
58
  outputs=[gr.Number(label="Spam probability")],
59
  title="Bayes or Spam?",
60
  description="Choose and configure your model, and predict if your email is a spam! 📨<br>COMING SOON: NN and LLM models.",
61
  examples=[
62
- [BAYES, "enron actuals for june 26, 2000"],
63
- [BAYES, "stop the aging clock nerissa"],
 
64
  ],
65
  article="This is a demo of the models in the [Bayes or Spam?](https://github.com/tbitai/bayes-or-spam) project.",
66
  )
 
38
  interesting_probs = get_interesting_probs(probs, intr_threshold)
39
  return combine(interesting_probs)
40
 
41
+ DEFAULT_INTR_THRESHOLD = 15
42
+
43
  MODELS = [
44
  BAYES := "Bayes Enron1 spam",
45
  ]
 
53
  inputs=[
54
  gr.Dropdown(choices=MODELS, value=BAYES, label="Model"),
55
  gr.Checkbox(label="Unbias", info="Correct Graham's bias?"),
56
+ gr.Slider(minimum=1, maximum=DEFAULT_INTR_THRESHOLD + 5, step=1, value=DEFAULT_INTR_THRESHOLD,
57
+ label="Interestingness threshold",
58
+ info=f"How many of the most interesting words to select in the probability calculation? ({DEFAULT_INTR_THRESHOLD} for Graham)"),
59
  gr.TextArea(label="Email"),
60
  ],
61
  outputs=[gr.Number(label="Spam probability")],
62
  title="Bayes or Spam?",
63
  description="Choose and configure your model, and predict if your email is a spam! 📨<br>COMING SOON: NN and LLM models.",
64
  examples=[
65
+ [BAYES, False, DEFAULT_INTR_THRESHOLD, "enron actuals for june 26, 2000"],
66
+ [BAYES, False, DEFAULT_INTR_THRESHOLD, nerissa_email := "stop the aging clock nerissa"],
67
+ [BAYES, True, DEFAULT_INTR_THRESHOLD, nerissa_email],
68
  ],
69
  article="This is a demo of the models in the [Bayes or Spam?](https://github.com/tbitai/bayes-or-spam) project.",
70
  )