Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -128,7 +128,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):
|
132 |
results = []
|
133 |
debug_output = io.StringIO()
|
134 |
with contextlib.redirect_stdout(debug_output):
|
@@ -145,7 +145,8 @@ def generate_names(n, sex, min_len, max_len, min_bible_len, max_bible_len, pop_l
|
|
145 |
sex=sex if sex in {"M", "F"} else None,
|
146 |
debug=debug_flag,
|
147 |
)
|
148 |
-
last
|
|
|
149 |
results.append(f"{bible} {normal} {last}")
|
150 |
except Exception as e:
|
151 |
results.append(f"[Error: {e}]")
|
@@ -171,6 +172,9 @@ with gr.Blocks() as demo:
|
|
171 |
with gr.Row():
|
172 |
pop_low_slider = gr.Slider(0.0, 1.0, value=0.95, step=0.01, label="SSA Popularity: Low Percentile")
|
173 |
pop_high_slider = gr.Slider(0.0, 1.0, value=1.0, step=0.01, label="SSA Popularity: High Percentile")
|
|
|
|
|
|
|
174 |
|
175 |
debug_checkbox = gr.Checkbox(label="Show debug output", value=True)
|
176 |
|
@@ -190,7 +194,8 @@ with gr.Blocks() as demo:
|
|
190 |
bible_max_len,
|
191 |
pop_low_slider,
|
192 |
pop_high_slider,
|
193 |
-
debug_checkbox
|
|
|
194 |
],
|
195 |
outputs=[output_box, debug_box],
|
196 |
)
|
|
|
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):
|
|
|
145 |
sex=sex if sex in {"M", "F"} else None,
|
146 |
debug=debug_flag,
|
147 |
)
|
148 |
+
if last is None:
|
149 |
+
last = random.choice(last_names)
|
150 |
results.append(f"{bible} {normal} {last}")
|
151 |
except Exception as e:
|
152 |
results.append(f"[Error: {e}]")
|
|
|
172 |
with gr.Row():
|
173 |
pop_low_slider = gr.Slider(0.0, 1.0, value=0.95, step=0.01, label="SSA Popularity: Low Percentile")
|
174 |
pop_high_slider = gr.Slider(0.0, 1.0, value=1.0, step=0.01, label="SSA Popularity: High Percentile")
|
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 |
|
|
|
194 |
bible_max_len,
|
195 |
pop_low_slider,
|
196 |
pop_high_slider,
|
197 |
+
debug_checkbox,
|
198 |
+
last_name_input,
|
199 |
],
|
200 |
outputs=[output_box, debug_box],
|
201 |
)
|