Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,10 +19,11 @@ def extract_separators_from_string(separators_str):
|
|
| 19 |
""")
|
| 20 |
|
| 21 |
def change_split_selection(text, slider_count, split_selection, separator_selection):
|
|
|
|
| 22 |
separator_selection.update(interactive=(split_selection==LABEL_RECURSIVE))
|
| 23 |
return 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)
|
| 28 |
|
|
@@ -89,6 +90,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 89 |
separator_selection = gr.Textbox(
|
| 90 |
value=["\n\n", "\n", ".", " ", ""],
|
| 91 |
label="Separators used in RecursiveCharacterTextSplitter",
|
|
|
|
| 92 |
)
|
| 93 |
with gr.Row():
|
| 94 |
length_unit_selection = gr.Dropdown(
|
|
|
|
| 19 |
""")
|
| 20 |
|
| 21 |
def change_split_selection(text, slider_count, split_selection, separator_selection):
|
| 22 |
+
print("Updating separator selection interactivity:")
|
| 23 |
separator_selection.update(interactive=(split_selection==LABEL_RECURSIVE))
|
| 24 |
return chunk(text, slider_count, split_selection, separator_selection)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
def chunk(text, length, splitter_selection, separators_str):
|
| 28 |
separators = extract_separators_from_string(separators_str)
|
| 29 |
|
|
|
|
| 90 |
separator_selection = gr.Textbox(
|
| 91 |
value=["\n\n", "\n", ".", " ", ""],
|
| 92 |
label="Separators used in RecursiveCharacterTextSplitter",
|
| 93 |
+
interactive=False,
|
| 94 |
)
|
| 95 |
with gr.Row():
|
| 96 |
length_unit_selection = gr.Dropdown(
|