m-ric HF staff commited on
Commit
a9a7993
1 Parent(s): 7632c21

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -174,6 +174,9 @@ STYLE = """
174
  .nonselected-sequence {
175
  background-color: var(--primary-500);
176
  }
 
 
 
177
  """
178
 
179
 
@@ -216,10 +219,10 @@ def generate_nodes(node, step):
216
  selected_class = "selected-sequence"
217
  else:
218
  selected_class = "nonselected-sequence"
219
- return f"<li> <a href='#' class='end-of-text child {selected_class}'> <span> <b>{clean(token)}</b> <br>Total score: {node.total_score:.2f}</span> </a> </li>"
220
 
221
  html_content = (
222
- f"<li> <a href='#' class='nonfinal child'> <span> <b>{clean(token)}</b> </span>"
223
  )
224
  if node.table is not None:
225
  html_content += node.table
@@ -238,7 +241,7 @@ def generate_nodes(node, step):
238
  def generate_html(start_sentence, original_tree):
239
  html_output = f"""<div class="custom-container">
240
  <div class="tree">
241
- <ul> <li> <a href='#' id='root'> <span> <b>{start_sentence}</b> </span> {original_tree.table} </a>"""
242
  html_output += "<ul> "
243
  for subnode in original_tree.children.values():
244
  html_output += generate_nodes(subnode, step=1)
@@ -487,7 +490,7 @@ This parameter will not impact the beam search paths, but only influence the cho
487
  )
488
  with gr.Row():
489
  n_steps = gr.Slider(
490
- label="Number of steps", minimum=1, maximum=10, step=1, value=10
491
  )
492
  n_beams = gr.Slider(
493
  label="Number of beams", minimum=2, maximum=4, step=1, value=4
 
174
  .nonselected-sequence {
175
  background-color: var(--primary-500);
176
  }
177
+ .nopadding {
178
+ padding-left: 0;
179
+ }
180
  """
181
 
182
 
 
219
  selected_class = "selected-sequence"
220
  else:
221
  selected_class = "nonselected-sequence"
222
+ return f"<li> <a class='end-of-text child {selected_class}'> <span> <b>{clean(token)}</b> <br>Total score: {node.total_score:.2f}</span> </a> </li>"
223
 
224
  html_content = (
225
+ f"<li> <a class='nonfinal child'> <span> <b>{clean(token)}</b> </span>"
226
  )
227
  if node.table is not None:
228
  html_content += node.table
 
241
  def generate_html(start_sentence, original_tree):
242
  html_output = f"""<div class="custom-container">
243
  <div class="tree">
244
+ <ul> <li> <a id='root' class="nopadding"> <span> <b>{start_sentence}</b> </span> {original_tree.table} </a>"""
245
  html_output += "<ul> "
246
  for subnode in original_tree.children.values():
247
  html_output += generate_nodes(subnode, step=1)
 
490
  )
491
  with gr.Row():
492
  n_steps = gr.Slider(
493
+ label="Number of steps", minimum=1, maximum=12, step=1, value=5
494
  )
495
  n_beams = gr.Slider(
496
  label="Number of beams", minimum=2, maximum=4, step=1, value=4