Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -26,11 +26,10 @@ def extract_separators_from_string(separators_str):
|
|
26 |
Please type it in the correct format: "['separator_1', 'separator_2', ...]"
|
27 |
""")
|
28 |
|
29 |
-
def change_split_selection(
|
30 |
return (
|
31 |
gr.Textbox.update(visible=(split_selection==LABEL_RECURSIVE)),
|
32 |
gr.Radio.update(visible=(split_selection==LABEL_RECURSIVE)),
|
33 |
-
chunk(text, slider_count, split_selection, separators_selection, length_unit_selection, chunk_overlap)
|
34 |
)
|
35 |
|
36 |
def chunk(text, length, splitter_selection, separators_str, length_unit_selection, chunk_overlap):
|
@@ -167,16 +166,16 @@ with gr.Blocks(theme=gr.themes.Soft(text_size='lg', font=["monospace"], primary_
|
|
167 |
|
168 |
split_selection.change(
|
169 |
fn=change_split_selection,
|
170 |
-
inputs=
|
171 |
-
outputs=[separators_selection, separator_preset_selection
|
172 |
)
|
173 |
separator_preset_selection.change(
|
174 |
fn=change_preset_separators,
|
175 |
inputs=separator_preset_selection,
|
176 |
-
outputs=
|
177 |
)
|
178 |
gr.on(
|
179 |
-
[text.change, length_unit_selection.change, separators_selection.change, slider_count.change, chunk_overlap.change],
|
180 |
chunk,
|
181 |
[text, slider_count, split_selection, separators_selection, length_unit_selection, chunk_overlap],
|
182 |
outputs=out
|
|
|
26 |
Please type it in the correct format: "['separator_1', 'separator_2', ...]"
|
27 |
""")
|
28 |
|
29 |
+
def change_split_selection(split_selection):
|
30 |
return (
|
31 |
gr.Textbox.update(visible=(split_selection==LABEL_RECURSIVE)),
|
32 |
gr.Radio.update(visible=(split_selection==LABEL_RECURSIVE)),
|
|
|
33 |
)
|
34 |
|
35 |
def chunk(text, length, splitter_selection, separators_str, length_unit_selection, chunk_overlap):
|
|
|
166 |
|
167 |
split_selection.change(
|
168 |
fn=change_split_selection,
|
169 |
+
inputs=split_selection,
|
170 |
+
outputs=[separators_selection, separator_preset_selection],
|
171 |
)
|
172 |
separator_preset_selection.change(
|
173 |
fn=change_preset_separators,
|
174 |
inputs=separator_preset_selection,
|
175 |
+
outputs=separators_selection,
|
176 |
)
|
177 |
gr.on(
|
178 |
+
[text.change, length_unit_selection.change, separators_selection.change, split_selection.change, slider_count.change, chunk_overlap.change],
|
179 |
chunk,
|
180 |
[text, slider_count, split_selection, separators_selection, length_unit_selection, chunk_overlap],
|
181 |
outputs=out
|