jobian commited on
Commit
447cde6
·
1 Parent(s): ab48baa

Changed styling of tables for darkmode

Browse files
Files changed (1) hide show
  1. app.py +39 -9
app.py CHANGED
@@ -67,20 +67,50 @@ def _df_to_html_table(df: pd.DataFrame, title: str) -> str:
67
 
68
 
69
  def _style_block() -> str:
70
- # Simple CSS to make HTML tables readable in Gradio
71
  return """
72
  <style>
73
- .tbl { margin: 1rem 0; padding: 0.5rem 0.75rem; background: #fafafa; border-radius: 12px; }
74
- .tbl h4 { margin: 0.25rem 0 0.75rem; font-weight: 600; }
75
- .tbl table { border-collapse: collapse; width: 100%; font-size: 14px; }
76
- .tbl th, .tbl td { border: 1px solid #ddd; padding: 8px; vertical-align: top; }
77
- .tbl tr:nth-child(even) { background-color: #f9f9f9; }
78
- .tbl th { background-color: #f0f0f0; text-align: left; }
79
- .meta { font-size: 12px; color: #666; margin-top: 0.25rem; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  </style>
81
  """
82
 
83
 
 
84
  def extract_tables(file_obj) -> Tuple[str, List[str], List[str], str]:
85
  """
86
  Main pipeline:
@@ -287,7 +317,7 @@ def extract_tables(file_obj) -> Tuple[str, List[str], List[str], str]:
287
  with gr.Blocks(title="GMFT Table Extraction PoC", theme=gr.themes.Soft()) as demo:
288
  gr.Markdown(
289
  """
290
- # GMFT Table Extraction PoC
291
  Upload a **text-based** PDF and extract tables to structured JSON.
292
  The UI renders detected tables; you can also download the JSON + metrics.
293
  """
 
67
 
68
 
69
  def _style_block() -> str:
70
+ # Dark-mode friendly CSS
71
  return """
72
  <style>
73
+ .tbl {
74
+ margin: 1rem 0;
75
+ padding: 0.5rem 0.75rem;
76
+ background: var(--block-background-fill);
77
+ border-radius: 12px;
78
+ color: var(--body-text-color);
79
+ }
80
+ .tbl h4 {
81
+ margin: 0.25rem 0 0.75rem;
82
+ font-weight: 600;
83
+ color: var(--body-text-color);
84
+ }
85
+ .tbl table {
86
+ border-collapse: collapse;
87
+ width: 100%;
88
+ font-size: 14px;
89
+ color: var(--body-text-color);
90
+ }
91
+ .tbl th, .tbl td {
92
+ border: 1px solid var(--border-color-primary);
93
+ padding: 8px;
94
+ vertical-align: top;
95
+ }
96
+ .tbl tr:nth-child(even) {
97
+ background-color: var(--background-fill-secondary);
98
+ }
99
+ .tbl th {
100
+ background-color: var(--background-fill-primary);
101
+ text-align: left;
102
+ color: var(--body-text-color);
103
+ }
104
+ .meta {
105
+ font-size: 12px;
106
+ color: var(--body-text-color-subdued);
107
+ margin-top: 0.25rem;
108
+ }
109
  </style>
110
  """
111
 
112
 
113
+
114
  def extract_tables(file_obj) -> Tuple[str, List[str], List[str], str]:
115
  """
116
  Main pipeline:
 
317
  with gr.Blocks(title="GMFT Table Extraction PoC", theme=gr.themes.Soft()) as demo:
318
  gr.Markdown(
319
  """
320
+ # Table Extraction
321
  Upload a **text-based** PDF and extract tables to structured JSON.
322
  The UI renders detected tables; you can also download the JSON + metrics.
323
  """