Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 {
|
| 1572 |
-
|
| 1573 |
-
|
| 1574 |
-
|
| 1575 |
-
.
|
| 1576 |
-
.kw-
|
| 1577 |
-
.kw-
|
|
|
|
|
|
|
|
|
|
| 1578 |
</style>
|
| 1579 |
"""
|
| 1580 |
|
|
|
|
| 1581 |
with gr.Blocks(title="Adaptive SQL Trainer — Randomized Domains") as demo:
|
| 1582 |
-
gr.
|
| 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.
|
| 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():
|