Spaces:
Sleeping
Sleeping
Commit ·
d9abff2
1
Parent(s): 44a8b1d
Warn when no catch-all Other category is present in category list
Browse files
app.py
CHANGED
|
@@ -18,9 +18,11 @@ from theme import inject_css, render_wordmark
|
|
| 18 |
# Import catllm
|
| 19 |
try:
|
| 20 |
import catllm
|
|
|
|
| 21 |
CATLLM_AVAILABLE = True
|
| 22 |
except ImportError as e:
|
| 23 |
print(f"Warning: Could not import catllm: {e}")
|
|
|
|
| 24 |
CATLLM_AVAILABLE = False
|
| 25 |
|
| 26 |
MAX_CATEGORIES = 10
|
|
@@ -1704,6 +1706,14 @@ with col_input:
|
|
| 1704 |
st.session_state.category_count += 1
|
| 1705 |
st.rerun()
|
| 1706 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1707 |
if st.button("Categorize Data", type="primary", use_container_width=True):
|
| 1708 |
if input_data is None:
|
| 1709 |
st.error("Please upload data first")
|
|
|
|
| 18 |
# Import catllm
|
| 19 |
try:
|
| 20 |
import catllm
|
| 21 |
+
from catllm import has_other_category
|
| 22 |
CATLLM_AVAILABLE = True
|
| 23 |
except ImportError as e:
|
| 24 |
print(f"Warning: Could not import catllm: {e}")
|
| 25 |
+
has_other_category = None
|
| 26 |
CATLLM_AVAILABLE = False
|
| 27 |
|
| 28 |
MAX_CATEGORIES = 10
|
|
|
|
| 1706 |
st.session_state.category_count += 1
|
| 1707 |
st.rerun()
|
| 1708 |
|
| 1709 |
+
if categories_entered and has_other_category and not has_other_category(categories_entered):
|
| 1710 |
+
st.warning(
|
| 1711 |
+
"No catch-all category detected. Responses that don't fit your categories "
|
| 1712 |
+
"will still be forced into one. Consider adding **\"Other\"** or "
|
| 1713 |
+
"**\"None of the above\"**.",
|
| 1714 |
+
icon="⚠️",
|
| 1715 |
+
)
|
| 1716 |
+
|
| 1717 |
if st.button("Categorize Data", type="primary", use_container_width=True):
|
| 1718 |
if input_data is None:
|
| 1719 |
st.error("Please upload data first")
|