cdleong commited on
Commit
6c2c317
·
verified ·
1 Parent(s): ca620b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -2
app.py CHANGED
@@ -6,6 +6,46 @@ import io
6
  import contextlib
7
  import requests
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  def download_file(url: str, dest_path: Path):
10
  if dest_path.exists():
11
  print(f"{dest_path.name} already exists. Skipping download.")
@@ -128,7 +168,7 @@ def get_normal_and_bible(
128
  return ssa_name, bible_name
129
 
130
  # --- Gradio app ---
131
- def generate_names(n, sex, min_len, max_len, min_bible_len, max_bible_len, pop_low, pop_high, debug_flag, last=None):
132
  results = []
133
  debug_output = io.StringIO()
134
  with contextlib.redirect_stdout(debug_output):
@@ -143,6 +183,7 @@ def generate_names(n, sex, min_len, max_len, min_bible_len, max_bible_len, pop_l
143
  max_length_bible=max_bible_len,
144
  ssa_popularity_percentile=(pop_low, pop_high),
145
  sex=sex if sex in {"M", "F"} else None,
 
146
  debug=(i==0),
147
  )
148
  if last is None:
@@ -175,6 +216,10 @@ with gr.Blocks() as demo:
175
  with gr.Row():
176
  last_name_input = gr.Textbox(label="Last Name")
177
 
 
 
 
 
178
 
179
  debug_checkbox = gr.Checkbox(label="Show debug output", value=True)
180
 
@@ -195,7 +240,8 @@ with gr.Blocks() as demo:
195
  pop_low_slider,
196
  pop_high_slider,
197
  debug_checkbox,
198
- last_name_input,
 
199
  ],
200
  outputs=[output_box, debug_box],
201
  )
 
6
  import contextlib
7
  import requests
8
 
9
+ FORBIDDEN_NAMES ={"Judas",
10
+ "Maher-shalal-hash-baz",
11
+ "Bathsheba",
12
+ "Jephthah",
13
+ "Jehoshaphat",
14
+ "Tiebreaker",
15
+ "Boanerges",
16
+ "Jezebel",
17
+ "Gomorrah",
18
+ "Hymenaeus",
19
+ "Herod",
20
+ "Pilate",
21
+ "Doeg",
22
+ "Ziph",
23
+ "Phygelus",
24
+ "Hermogenes",
25
+ "Philetus",
26
+ "Balaam",
27
+ "Achan",
28
+ "Caiaphas",
29
+ "Pontius",
30
+ "Ahab",
31
+ "Manasseh",
32
+ "Rehoboam",
33
+ "Nebuchadnezzar",
34
+ "Delilah",
35
+ "Lo-ammi",
36
+ "Lo-ruhamah",
37
+ "Beelzebub",
38
+ "Ichabod",
39
+ "Saphira",
40
+ "Jushab-hesed",
41
+ "Benjarman",
42
+ "Cain",
43
+ "Esau",
44
+ "Machiavelli", # found
45
+ "Barabbas",
46
+ "Sapphira",
47
+ "Shur",
48
+ }
49
  def download_file(url: str, dest_path: Path):
50
  if dest_path.exists():
51
  print(f"{dest_path.name} already exists. Skipping download.")
 
168
  return ssa_name, bible_name
169
 
170
  # --- Gradio app ---
171
+ def generate_names(n, sex, min_len, max_len, min_bible_len, max_bible_len, pop_low, pop_high, debug_flag, last=None, forbidden_names=None):
172
  results = []
173
  debug_output = io.StringIO()
174
  with contextlib.redirect_stdout(debug_output):
 
183
  max_length_bible=max_bible_len,
184
  ssa_popularity_percentile=(pop_low, pop_high),
185
  sex=sex if sex in {"M", "F"} else None,
186
+ forbidden_names=forbidden_names,
187
  debug=(i==0),
188
  )
189
  if last is None:
 
216
  with gr.Row():
217
  last_name_input = gr.Textbox(label="Last Name")
218
 
219
+ with gr.Row():
220
+ forbidden_names_input = gr.Textbox(label="FORBIDDEN NAMES (comma-separated)", value=FORBIDDEN_NAMES)
221
+ forbidden_names = set(forbidden_names_input.split(","))
222
+
223
 
224
  debug_checkbox = gr.Checkbox(label="Show debug output", value=True)
225
 
 
240
  pop_low_slider,
241
  pop_high_slider,
242
  debug_checkbox,
243
+ last=last_name_input,
244
+ forbidden_names=forbidden_names,
245
  ],
246
  outputs=[output_box, debug_box],
247
  )