Spaces:
Running
Running
Commit ·
41b6ddb
1
Parent(s): 5a90b2a
fix: parser table renders on HF via use_container_width (drop width=1200)
Browse filesThe blank-table-behind-HF-proxy was caused by the fixed width=1200 pixel
arg to st.dataframe, not st.dataframe itself — the lexicon demo renders
fine with use_container_width=True. Restore the interactive grid with
use_container_width + per-column widths (wide feats, narrow numerics)
instead of the static st.table stopgap.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- pages/1_parsing_demo.py +22 -5
pages/1_parsing_demo.py
CHANGED
|
@@ -89,11 +89,28 @@ with tab1:
|
|
| 89 |
df = analyze_text(text)
|
| 90 |
sent_count = df["sent_id"].nunique()
|
| 91 |
st.text(f"Analyzed {len(df)} tokens in {sent_count} sentences with {model_name} model.")
|
| 92 |
-
#
|
| 93 |
-
#
|
| 94 |
-
#
|
| 95 |
-
#
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
@st.cache_data
|
| 99 |
def convert_df(df):
|
|
|
|
| 89 |
df = analyze_text(text)
|
| 90 |
sent_count = df["sent_id"].nunique()
|
| 91 |
st.text(f"Analyzed {len(df)} tokens in {sent_count} sentences with {model_name} model.")
|
| 92 |
+
# Use use_container_width instead of a fixed width=1200: the fixed
|
| 93 |
+
# pixel width made st.dataframe render blank behind HF Spaces' proxy
|
| 94 |
+
# (the summary line showed but the grid never painted). The lexicon
|
| 95 |
+
# demo already renders fine this way. Column widths tuned so the wide
|
| 96 |
+
# feats/lemma columns get room and the numeric columns stay narrow.
|
| 97 |
+
st.dataframe(
|
| 98 |
+
df,
|
| 99 |
+
use_container_width=True,
|
| 100 |
+
hide_index=True,
|
| 101 |
+
column_config={
|
| 102 |
+
"sent_id": st.column_config.TextColumn(width="small"),
|
| 103 |
+
"token_id": st.column_config.NumberColumn(width="small"),
|
| 104 |
+
"form": st.column_config.TextColumn(width="small"),
|
| 105 |
+
"lemma": st.column_config.TextColumn(width="small"),
|
| 106 |
+
"upos": st.column_config.TextColumn(width="small"),
|
| 107 |
+
"xpos": st.column_config.TextColumn(width="small"),
|
| 108 |
+
"feats": st.column_config.TextColumn(width="large"),
|
| 109 |
+
"head": st.column_config.NumberColumn(width="small"),
|
| 110 |
+
"deprel": st.column_config.TextColumn(width="small"),
|
| 111 |
+
"ent_type": st.column_config.TextColumn(width="small"),
|
| 112 |
+
},
|
| 113 |
+
)
|
| 114 |
|
| 115 |
@st.cache_data
|
| 116 |
def convert_df(df):
|