m-ric HF staff commited on
Commit
51c0840
1 Parent(s): b7b6ca1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -20,8 +20,10 @@ def extract_separators_from_string(separators_str):
20
 
21
  def change_split_selection(text, slider_count, split_selection, separator_selection):
22
  print("Updating separator selection interactivity:")
23
- return gr.Textbox.update(interactive=(split_selection==LABEL_RECURSIVE)), chunk(text, slider_count, split_selection, separator_selection)
24
-
 
 
25
 
26
  def chunk(text, length, splitter_selection, separators_str):
27
  separators = extract_separators_from_string(separators_str)
@@ -80,7 +82,7 @@ df_test .to_parquet("hf://datasets/username/my_dataset/test.parquet")
80
  """
81
 
82
 
83
- with gr.Blocks(theme=gr.themes.Soft(), css="#textbox_id {color: red, font-samily:monospace}") as demo:
84
  text = gr.Textbox(label="Your text 🪶", value=ESSAY)
85
  with gr.Row():
86
  split_selection = gr.Dropdown(
@@ -95,7 +97,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css="#textbox_id {color: red, font-samily
95
  elem_id="textbox_id",
96
  value=["\n\n", "\n", ".", " ", ""],
97
  label="Separators used in RecursiveCharacterTextSplitter",
98
- interactive=False,
99
  )
100
  with gr.Row():
101
  length_unit_selection = gr.Dropdown(
 
20
 
21
  def change_split_selection(text, slider_count, split_selection, separator_selection):
22
  print("Updating separator selection interactivity:")
23
+ return (
24
+ gr.Textbox.update(visible=(split_selection==LABEL_RECURSIVE)),
25
+ chunk(text, slider_count, split_selection, separator_selection)
26
+ )
27
 
28
  def chunk(text, length, splitter_selection, separators_str):
29
  separators = extract_separators_from_string(separators_str)
 
82
  """
83
 
84
 
85
+ with gr.Blocks(theme=gr.themes.Soft(), css="#textbox_id {color: red; font-samily:monospace}") as demo:
86
  text = gr.Textbox(label="Your text 🪶", value=ESSAY)
87
  with gr.Row():
88
  split_selection = gr.Dropdown(
 
97
  elem_id="textbox_id",
98
  value=["\n\n", "\n", ".", " ", ""],
99
  label="Separators used in RecursiveCharacterTextSplitter",
100
+ visible=False,
101
  )
102
  with gr.Row():
103
  length_unit_selection = gr.Dropdown(