Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -15,9 +15,13 @@ def filter_dataset(dataset_name, split_name, keywords_text):
|
|
15 |
if not keywords:
|
16 |
return pd.DataFrame(), "Error: No keywords provided."
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
21 |
|
22 |
# --- 3. Select Indices (Efficiently) ---
|
23 |
matching_indices = []
|
|
|
15 |
if not keywords:
|
16 |
return pd.DataFrame(), "Error: No keywords provided."
|
17 |
|
18 |
+
# Define a filtering function that handles potential KeyErrors
|
19 |
+
def filter_func(example):
|
20 |
+
prompt_value = example.get("prompt", "") # Get prompt, default to empty string
|
21 |
+
return any(keyword in prompt_value.lower() for keyword in keywords)
|
22 |
+
|
23 |
+
filtered_dataset = dataset.filter(filter_func)
|
24 |
+
|
25 |
|
26 |
# --- 3. Select Indices (Efficiently) ---
|
27 |
matching_indices = []
|