m-ric HF staff commited on
Commit
06948d6
β€’
1 Parent(s): 13fd821

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -425,6 +425,10 @@ def get_beam_search_html(input_text, number_steps, number_beams, length_penalty,
425
  return html, markdown
426
 
427
 
 
 
 
 
428
  with gr.Blocks(
429
  theme=gr.themes.Soft(
430
  primary_hue=gr.themes.colors.yellow,
@@ -461,8 +465,10 @@ This parameter will not impact the beam search paths, but only influence the cho
461
  label="Length penalty", minimum=-3, maximum=3, step=0.5, value=1
462
  )
463
  n_sequences = gr.Slider(
464
- label="Number of sequences", minimum=1, maximum=n_beams, step=1, value=n_beams
465
  )
 
 
466
  button = gr.Button()
467
  out_html = gr.Markdown()
468
  out_markdown = gr.Markdown()
 
425
  return html, markdown
426
 
427
 
428
+ def change_n_sequences(n_beams):
429
+ return gr.Slider.update(maximum=n_beams)
430
+
431
+
432
  with gr.Blocks(
433
  theme=gr.themes.Soft(
434
  primary_hue=gr.themes.colors.yellow,
 
465
  label="Length penalty", minimum=-3, maximum=3, step=0.5, value=1
466
  )
467
  n_sequences = gr.Slider(
468
+ label="Number of sequences", minimum=1, maximum=4, step=1, value=3
469
  )
470
+
471
+ n_beams.change(fn=change_n_sequences, inputs=n_beams, outputs=n_sequences)
472
  button = gr.Button()
473
  out_html = gr.Markdown()
474
  out_markdown = gr.Markdown()