unijoh commited on
Commit
aee4959
·
verified ·
1 Parent(s): 81b6b5e

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py CHANGED
@@ -151,6 +151,30 @@ CSS = """
151
  border: 0 !important;
152
  box-shadow: none !important;
153
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  """
155
 
156
  # ----------------------------
@@ -603,6 +627,7 @@ with gr.Blocks(css=CSS, title="Marka") as demo:
603
  btn_lang_en_off = gr.Button("English", variant="secondary", elem_id="lang_en_off", visible=False)
604
 
605
  out_df = gr.Dataframe(
 
606
  value=pd.DataFrame(columns=[UI["fo"]["w"], UI["fo"]["t"], UI["fo"]["s"]]),
607
  wrap=True, interactive=False, show_label=False,
608
  row_count=(0, "fixed"), col_count=(3, "fixed"),
@@ -612,6 +637,7 @@ with gr.Blocks(css=CSS, title="Marka") as demo:
612
  expanded_acc = gr.Accordion("Útgreinað marking / Expanded tags", open=False, visible=False)
613
  with expanded_acc:
614
  out_mean_df = gr.Dataframe(
 
615
  value=pd.DataFrame(columns=[UI["fo"]["w"], UI["fo"]["t"], UI["fo"]["m"]]),
616
  wrap=True, interactive=False, show_label=False,
617
  row_count=(0, "fixed"), col_count=(3, "fixed"),
 
151
  border: 0 !important;
152
  box-shadow: none !important;
153
  }
154
+
155
+ /* Dataframes: keep Word/Tag on one line; let Analysis wrap.
156
+ If a word/tag is very long, the dataframe will scroll horizontally instead of wrapping. */
157
+ #out_df, #out_mean_df{
158
+ overflow-x:auto !important;
159
+ }
160
+ #out_df table, #out_mean_df table{
161
+ table-layout:auto !important;
162
+ width:max-content !important;
163
+ }
164
+ /* 1st + 2nd column (Word/Tag): never wrap */
165
+ #out_df th:nth-child(1), #out_df td:nth-child(1),
166
+ #out_df th:nth-child(2), #out_df td:nth-child(2),
167
+ #out_mean_df th:nth-child(1), #out_mean_df td:nth-child(1),
168
+ #out_mean_df th:nth-child(2), #out_mean_df td:nth-child(2){
169
+ white-space:nowrap !important;
170
+ }
171
+ /* 3rd column (Útgreining / Analysis): may wrap */
172
+ #out_df th:nth-child(3), #out_df td:nth-child(3),
173
+ #out_mean_df th:nth-child(3), #out_mean_df td:nth-child(3){
174
+ white-space:normal !important;
175
+ word-break:break-word !important;
176
+ }
177
+
178
  """
179
 
180
  # ----------------------------
 
627
  btn_lang_en_off = gr.Button("English", variant="secondary", elem_id="lang_en_off", visible=False)
628
 
629
  out_df = gr.Dataframe(
630
+ elem_id="out_df",
631
  value=pd.DataFrame(columns=[UI["fo"]["w"], UI["fo"]["t"], UI["fo"]["s"]]),
632
  wrap=True, interactive=False, show_label=False,
633
  row_count=(0, "fixed"), col_count=(3, "fixed"),
 
637
  expanded_acc = gr.Accordion("Útgreinað marking / Expanded tags", open=False, visible=False)
638
  with expanded_acc:
639
  out_mean_df = gr.Dataframe(
640
+ elem_id="out_mean_df",
641
  value=pd.DataFrame(columns=[UI["fo"]["w"], UI["fo"]["t"], UI["fo"]["m"]]),
642
  wrap=True, interactive=False, show_label=False,
643
  row_count=(0, "fixed"), col_count=(3, "fixed"),