unijoh commited on
Commit
6d15942
·
verified ·
1 Parent(s): e9c4456

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -18
app.py CHANGED
@@ -152,29 +152,37 @@ CSS = """
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,9 +635,9 @@ with gr.Blocks(css=CSS, title="Marka") as demo:
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"),
634
  visible=False,
635
  )
@@ -637,9 +645,9 @@ with gr.Blocks(css=CSS, title="Marka") as demo:
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"),
644
  )
645
 
 
152
  box-shadow: none !important;
153
  }
154
 
155
+
156
+ /* Prevent the main "Marka / Tag" button from stretching vertically */
157
+ #btn_tag{
158
+ align-self:flex-start !important;
159
+ flex:0 0 auto !important;
160
+ height:fit-content !important;
161
+ }
162
+ #btn_tag button{
163
+ height:auto !important;
164
+ }
165
+
166
+ /* Dataframes: never wrap any cell; allow sideways scroll instead. */
167
  #out_df, #out_mean_df{
168
+ max-width:100% !important;
169
+ }
170
+ /* The scroll container is not always the outer div in Gradio, so target common wrappers too */
171
+ #out_df, #out_mean_df,
172
+ #out_df .table-wrap, #out_mean_df .table-wrap,
173
+ #out_df .wrap, #out_mean_df .wrap{
174
  overflow-x:auto !important;
175
+ display:block !important;
176
  }
177
  #out_df table, #out_mean_df table{
178
  table-layout:auto !important;
179
  width:max-content !important;
180
+ min-width:100% !important;
181
  }
182
+ #out_df th, #out_df td,
183
+ #out_mean_df th, #out_mean_df td{
 
 
 
184
  white-space:nowrap !important;
185
  }
 
 
 
 
 
 
 
186
  """
187
 
188
  # ----------------------------
 
635
  btn_lang_en_off = gr.Button("English", variant="secondary", elem_id="lang_en_off", visible=False)
636
 
637
  out_df = gr.Dataframe(
638
+ elem_id="out_df",
639
  value=pd.DataFrame(columns=[UI["fo"]["w"], UI["fo"]["t"], UI["fo"]["s"]]),
640
+ wrap=False, interactive=False, show_label=False,
641
  row_count=(0, "fixed"), col_count=(3, "fixed"),
642
  visible=False,
643
  )
 
645
  expanded_acc = gr.Accordion("Útgreinað marking / Expanded tags", open=False, visible=False)
646
  with expanded_acc:
647
  out_mean_df = gr.Dataframe(
648
+ elem_id="out_mean_df",
649
  value=pd.DataFrame(columns=[UI["fo"]["w"], UI["fo"]["t"], UI["fo"]["m"]]),
650
+ wrap=False, interactive=False, show_label=False,
651
  row_count=(0, "fixed"), col_count=(3, "fixed"),
652
  )
653