Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -1703,6 +1703,76 @@ html, body {
|
|
| 1703 |
margin-top: 23px !important;
|
| 1704 |
}
|
| 1705 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1706 |
/* Responsive refinement */
|
| 1707 |
@media (max-width: 1100px) {
|
| 1708 |
.hero-signal-grid {
|
|
@@ -1832,16 +1902,33 @@ def build_app():
|
|
| 1832 |
with gr.Column(elem_classes=["tab-body"]):
|
| 1833 |
gr.HTML('''<div class="section-head"><div class="section-kicker">Supervised Learning</div><h2>Choose a Target, Algorithm, and Evaluation Setup</h2><p>Build a preprocessing + model pipeline, evaluate it on a holdout split, compare baselines, and inspect generated code.</p></div>''')
|
| 1834 |
|
| 1835 |
-
# Groups the target, problem-type, and algorithm selectors on a single modeling row
|
| 1836 |
-
|
| 1837 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1838 |
problem_type = gr.Dropdown(
|
| 1839 |
label="Problem type",
|
| 1840 |
choices=["Auto", "classification", "regression"],
|
| 1841 |
value="Auto",
|
| 1842 |
interactive=True,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1843 |
)
|
| 1844 |
-
algorithm = gr.Dropdown(label="Algorithm", choices=ALL_ALGORITHMS, value="Auto", interactive=True)
|
| 1845 |
|
| 1846 |
# Configures the holdout-size control used by training, comparison, and code generation
|
| 1847 |
test_size = gr.Slider(0.1, 0.4, value=0.2, step=0.05, label="Holdout test size")
|
|
@@ -1862,10 +1949,10 @@ def build_app():
|
|
| 1862 |
code_btn = gr.Button("Generate Pipeline Code", variant="primary", elem_id="code-button")
|
| 1863 |
|
| 1864 |
# Creates the components that display model summaries, metrics, importance, comparisons, code, and artifacts
|
| 1865 |
-
model_summary = gr.Markdown("")
|
| 1866 |
model_metrics = gr.JSON(label="Evaluation metrics")
|
| 1867 |
feature_importance = gr.Dataframe(label="Feature importance / coefficient magnitude", interactive=False, wrap=True, elem_id="feature-importance")
|
| 1868 |
-
compare_summary = gr.Markdown("")
|
| 1869 |
leaderboard = gr.Dataframe(label="Baseline leaderboard", interactive=False, wrap=True, elem_id="leaderboard")
|
| 1870 |
pipeline_code = gr.Code(label="Selected algorithm pipeline", language="python", lines=30)
|
| 1871 |
model_artifact = gr.File(label="Trained pipeline artifact (.joblib)", interactive=False)
|
|
@@ -1884,7 +1971,7 @@ def build_app():
|
|
| 1884 |
)
|
| 1885 |
# Creates the agent execution button and result components for answers, code, and tool traces
|
| 1886 |
agent_btn = gr.Button("Run Machine Learning Agent", variant="primary", elem_id="agent-button")
|
| 1887 |
-
agent_answer = gr.Markdown("")
|
| 1888 |
with gr.Tabs(elem_classes=["result-tabs"]):
|
| 1889 |
with gr.Tab("Recommended Pipeline"):
|
| 1890 |
agent_code = gr.Code(label="Generated Python", language="python", lines=28)
|
|
|
|
| 1703 |
margin-top: 23px !important;
|
| 1704 |
}
|
| 1705 |
|
| 1706 |
+
/* =========================================================
|
| 1707 |
+
GRADIO FLOATING-UI / OUTPUT CLIPPING FIXES
|
| 1708 |
+
- Dropdown menus use floating positioning. backdrop-filter on
|
| 1709 |
+
an ancestor creates a new containing block and can shift the
|
| 1710 |
+
popup by the panel's page offset.
|
| 1711 |
+
- The original app-panel rule also used overflow:hidden, which
|
| 1712 |
+
can clip dropdowns and first-line Markdown headings.
|
| 1713 |
+
========================================================= */
|
| 1714 |
+
.app-panel {
|
| 1715 |
+
overflow: visible !important;
|
| 1716 |
+
backdrop-filter: none !important;
|
| 1717 |
+
-webkit-backdrop-filter: none !important;
|
| 1718 |
+
}
|
| 1719 |
+
|
| 1720 |
+
#main-tabs,
|
| 1721 |
+
#main-tabs [role="tabpanel"],
|
| 1722 |
+
#main-tabs .tab-body,
|
| 1723 |
+
.model-controls-row,
|
| 1724 |
+
.model-control {
|
| 1725 |
+
overflow: visible !important;
|
| 1726 |
+
}
|
| 1727 |
+
|
| 1728 |
+
.model-controls-row {
|
| 1729 |
+
position: relative !important;
|
| 1730 |
+
z-index: 40 !important;
|
| 1731 |
+
}
|
| 1732 |
+
|
| 1733 |
+
.model-control {
|
| 1734 |
+
position: relative !important;
|
| 1735 |
+
z-index: 41 !important;
|
| 1736 |
+
}
|
| 1737 |
+
|
| 1738 |
+
.model-control:focus-within {
|
| 1739 |
+
z-index: 1000 !important;
|
| 1740 |
+
}
|
| 1741 |
+
|
| 1742 |
+
/* Keep Gradio/Floating-UI dropdown option panels above the rest of the model tab. */
|
| 1743 |
+
.gradio-container [role="listbox"] {
|
| 1744 |
+
z-index: 100000 !important;
|
| 1745 |
+
}
|
| 1746 |
+
|
| 1747 |
+
/* Result Markdown: prevent the first heading (Model evaluation,
|
| 1748 |
+
Baseline comparison, or an agent heading such as ML assessment)
|
| 1749 |
+
from being clipped by the component's top edge. */
|
| 1750 |
+
.result-markdown {
|
| 1751 |
+
overflow: visible !important;
|
| 1752 |
+
padding-top: 10px !important;
|
| 1753 |
+
padding-bottom: 4px !important;
|
| 1754 |
+
min-height: 0 !important;
|
| 1755 |
+
}
|
| 1756 |
+
|
| 1757 |
+
.result-markdown > div,
|
| 1758 |
+
.result-markdown .prose,
|
| 1759 |
+
.result-markdown [data-testid="markdown"] {
|
| 1760 |
+
overflow: visible !important;
|
| 1761 |
+
}
|
| 1762 |
+
|
| 1763 |
+
.result-markdown h1,
|
| 1764 |
+
.result-markdown h2,
|
| 1765 |
+
.result-markdown h3,
|
| 1766 |
+
.result-markdown h4,
|
| 1767 |
+
.result-markdown h5,
|
| 1768 |
+
.result-markdown h6 {
|
| 1769 |
+
margin-top: .35rem !important;
|
| 1770 |
+
margin-bottom: .65rem !important;
|
| 1771 |
+
padding-top: .08em !important;
|
| 1772 |
+
line-height: 1.35 !important;
|
| 1773 |
+
overflow: visible !important;
|
| 1774 |
+
}
|
| 1775 |
+
|
| 1776 |
/* Responsive refinement */
|
| 1777 |
@media (max-width: 1100px) {
|
| 1778 |
.hero-signal-grid {
|
|
|
|
| 1902 |
with gr.Column(elem_classes=["tab-body"]):
|
| 1903 |
gr.HTML('''<div class="section-head"><div class="section-kicker">Supervised Learning</div><h2>Choose a Target, Algorithm, and Evaluation Setup</h2><p>Build a preprocessing + model pipeline, evaluate it on a holdout split, compare baselines, and inspect generated code.</p></div>''')
|
| 1904 |
|
| 1905 |
+
# Groups the target, problem-type, and algorithm selectors on a single modeling row.
|
| 1906 |
+
# The CSS hooks keep Gradio's floating dropdown menus anchored to these controls.
|
| 1907 |
+
with gr.Row(elem_classes=["model-controls-row"]):
|
| 1908 |
+
target = gr.Dropdown(
|
| 1909 |
+
label="Target column",
|
| 1910 |
+
choices=[],
|
| 1911 |
+
value=None,
|
| 1912 |
+
interactive=True,
|
| 1913 |
+
elem_id="target-column-dropdown",
|
| 1914 |
+
elem_classes=["model-control"],
|
| 1915 |
+
)
|
| 1916 |
problem_type = gr.Dropdown(
|
| 1917 |
label="Problem type",
|
| 1918 |
choices=["Auto", "classification", "regression"],
|
| 1919 |
value="Auto",
|
| 1920 |
interactive=True,
|
| 1921 |
+
elem_id="problem-type-dropdown",
|
| 1922 |
+
elem_classes=["model-control"],
|
| 1923 |
+
)
|
| 1924 |
+
algorithm = gr.Dropdown(
|
| 1925 |
+
label="Algorithm",
|
| 1926 |
+
choices=ALL_ALGORITHMS,
|
| 1927 |
+
value="Auto",
|
| 1928 |
+
interactive=True,
|
| 1929 |
+
elem_id="algorithm-dropdown",
|
| 1930 |
+
elem_classes=["model-control"],
|
| 1931 |
)
|
|
|
|
| 1932 |
|
| 1933 |
# Configures the holdout-size control used by training, comparison, and code generation
|
| 1934 |
test_size = gr.Slider(0.1, 0.4, value=0.2, step=0.05, label="Holdout test size")
|
|
|
|
| 1949 |
code_btn = gr.Button("Generate Pipeline Code", variant="primary", elem_id="code-button")
|
| 1950 |
|
| 1951 |
# Creates the components that display model summaries, metrics, importance, comparisons, code, and artifacts
|
| 1952 |
+
model_summary = gr.Markdown("", elem_id="model-summary", elem_classes=["result-markdown"])
|
| 1953 |
model_metrics = gr.JSON(label="Evaluation metrics")
|
| 1954 |
feature_importance = gr.Dataframe(label="Feature importance / coefficient magnitude", interactive=False, wrap=True, elem_id="feature-importance")
|
| 1955 |
+
compare_summary = gr.Markdown("", elem_id="compare-summary", elem_classes=["result-markdown"])
|
| 1956 |
leaderboard = gr.Dataframe(label="Baseline leaderboard", interactive=False, wrap=True, elem_id="leaderboard")
|
| 1957 |
pipeline_code = gr.Code(label="Selected algorithm pipeline", language="python", lines=30)
|
| 1958 |
model_artifact = gr.File(label="Trained pipeline artifact (.joblib)", interactive=False)
|
|
|
|
| 1971 |
)
|
| 1972 |
# Creates the agent execution button and result components for answers, code, and tool traces
|
| 1973 |
agent_btn = gr.Button("Run Machine Learning Agent", variant="primary", elem_id="agent-button")
|
| 1974 |
+
agent_answer = gr.Markdown("", elem_id="agent-answer", elem_classes=["result-markdown"])
|
| 1975 |
with gr.Tabs(elem_classes=["result-tabs"]):
|
| 1976 |
with gr.Tab("Recommended Pipeline"):
|
| 1977 |
agent_code = gr.Code(label="Generated Python", language="python", lines=28)
|