Spaces:
Runtime error
Runtime error
horriblecpp commited on
Commit ·
11b29e8
1
Parent(s): 8f8552b
Fix Streamlit nested expander exception using HTML details tag
Browse files- frontend/app.py +15 -5
frontend/app.py
CHANGED
|
@@ -881,11 +881,21 @@ with tab_intents:
|
|
| 881 |
is_match = bool(classified and classified.get("intent") == il and classified.get("domain") == dom)
|
| 882 |
prefix = "🎯 " if is_match else ""
|
| 883 |
|
| 884 |
-
#
|
| 885 |
-
|
| 886 |
-
|
| 887 |
-
|
| 888 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 889 |
|
| 890 |
|
| 891 |
# ---------------------------------------------------------------------------
|
|
|
|
| 881 |
is_match = bool(classified and classified.get("intent") == il and classified.get("domain") == dom)
|
| 882 |
prefix = "🎯 " if is_match else ""
|
| 883 |
|
| 884 |
+
# Use HTML details tag to avoid nested expander exception
|
| 885 |
+
utts_html = "".join([f"<li><small>{u}</small></li>" for u in utts])
|
| 886 |
+
st.markdown(
|
| 887 |
+
f"""
|
| 888 |
+
<details {"open" if is_match else ""}>
|
| 889 |
+
<summary style="cursor: pointer; padding: 2px 0;">
|
| 890 |
+
{prefix}<code>{il}</code> ({count})
|
| 891 |
+
</summary>
|
| 892 |
+
<ul style="list-style-type: none; margin-top: 5px; padding-left: 15px;">
|
| 893 |
+
{utts_html}
|
| 894 |
+
</ul>
|
| 895 |
+
</details>
|
| 896 |
+
""",
|
| 897 |
+
unsafe_allow_html=True
|
| 898 |
+
)
|
| 899 |
|
| 900 |
|
| 901 |
# ---------------------------------------------------------------------------
|