jtdearmon commited on
Commit
f5af369
·
verified ·
1 Parent(s): 7f805be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -9
app.py CHANGED
@@ -1567,19 +1567,30 @@ def preview_table(tbl: str):
1567
  # -------------------- UI --------------------
1568
  SQL_PREVIEW_STYLES = """
1569
  <style>
 
 
 
 
 
 
 
1570
  .sql-preview pre { white-space: pre-wrap; margin: 0; }
1571
- .sql-preview code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size: 13px; }
1572
- .kw { font-weight: 600; }
1573
- .kw-core { color: #1f6feb; } /* SELECT, FROM, WHERE, etc. */
1574
- .kw-join { color: #b80672; } /* JOIN family */
1575
- .kw-group { color: #107c41; } /* GROUP BY / HAVING */
1576
- .kw-order { color: #6f42c1; } /* ORDER BY / LIMIT / OFFSET */
1577
- .kw-ddl { color: #b26c12; } /* CREATE/INSERT/UPDATE/DELETE/etc. */
 
 
 
1578
  </style>
1579
  """
1580
 
 
1581
  with gr.Blocks(title="Adaptive SQL Trainer — Randomized Domains") as demo:
1582
- gr.Markdown(SQL_PREVIEW_STYLES)
1583
  gr.Markdown(
1584
  """
1585
  # 🧪 Adaptive SQL Trainer — Randomized Domains (SQLite)
@@ -1616,7 +1627,7 @@ with gr.Blocks(title="Adaptive SQL Trainer — Randomized Domains") as demo:
1616
  with gr.Column(scale=2):
1617
  prompt_md = gr.Markdown(visible=False)
1618
  sql_input = gr.Textbox(label="Your SQL", placeholder="Type SQL here (end ; optional).", lines=6, visible=False)
1619
- preview_md = gr.Markdown(visible=False)
1620
  er_image = gr.Image(label="Entity Diagram", value=draw_dynamic_erd(CURRENT_SCHEMA), height=PLOT_HEIGHT)
1621
 
1622
  with gr.Row():
 
1567
  # -------------------- UI --------------------
1568
  SQL_PREVIEW_STYLES = """
1569
  <style>
1570
+ :root {
1571
+ --sqlkw-core: #1f6feb; /* SELECT, FROM, WHERE */
1572
+ --sqlkw-join: #b80672; /* JOIN family */
1573
+ --sqlkw-group: #107c41; /* GROUP BY / HAVING */
1574
+ --sqlkw-order: #6f42c1; /* ORDER BY / LIMIT / OFFSET */
1575
+ --sqlkw-ddl: #b26c12; /* CREATE / INSERT / UPDATE / DELETE */
1576
+ }
1577
  .sql-preview pre { white-space: pre-wrap; margin: 0; }
1578
+ .sql-preview code {
1579
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
1580
+ font-size: 13px;
1581
+ }
1582
+ .sql-preview .kw { font-weight: 700; }
1583
+ .sql-preview .kw-core { color: var(--sqlkw-core) !important; }
1584
+ .sql-preview .kw-join { color: var(--sqlkw-join) !important; }
1585
+ .sql-preview .kw-group { color: var(--sqlkw-group) !important; }
1586
+ .sql-preview .kw-order { color: var(--sqlkw-order) !important; }
1587
+ .sql-preview .kw-ddl { color: var(--sqlkw-ddl) !important; }
1588
  </style>
1589
  """
1590
 
1591
+
1592
  with gr.Blocks(title="Adaptive SQL Trainer — Randomized Domains") as demo:
1593
+ gr.HTML(SQL_PREVIEW_STYLES)
1594
  gr.Markdown(
1595
  """
1596
  # 🧪 Adaptive SQL Trainer — Randomized Domains (SQLite)
 
1627
  with gr.Column(scale=2):
1628
  prompt_md = gr.Markdown(visible=False)
1629
  sql_input = gr.Textbox(label="Your SQL", placeholder="Type SQL here (end ; optional).", lines=6, visible=False)
1630
+ preview_md = gr.HTML(visible=False)
1631
  er_image = gr.Image(label="Entity Diagram", value=draw_dynamic_erd(CURRENT_SCHEMA), height=PLOT_HEIGHT)
1632
 
1633
  with gr.Row():