Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -1743,6 +1743,70 @@ html, body {
|
|
| 1743 |
}
|
| 1744 |
}
|
| 1745 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1746 |
'''
|
| 1747 |
|
| 1748 |
|
|
@@ -1830,18 +1894,20 @@ def build_app():
|
|
| 1830 |
# Builds the modeling tab for target selection, training, comparison, and pipeline generation
|
| 1831 |
with gr.Tab("02. ML Modeling", id="model-lab"):
|
| 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
|
| 1834 |
|
| 1835 |
# Groups the target, problem-type, and algorithm selectors on a single modeling row
|
| 1836 |
with gr.Row():
|
| 1837 |
-
target = gr.Dropdown(label="Target column", choices=[], value=None, interactive=True)
|
| 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")
|
|
@@ -1943,11 +2009,11 @@ def build_app():
|
|
| 1943 |
|
| 1944 |
# Keep the algorithm picker and generated pipeline aligned to the selected target
|
| 1945 |
# Synchronizes model choices and generated pipeline code whenever the target selection changes
|
| 1946 |
-
target.
|
| 1947 |
# Synchronizes model choices and generated pipeline code whenever the problem type changes
|
| 1948 |
-
problem_type.
|
| 1949 |
# Regenerates pipeline code whenever the selected algorithm changes
|
| 1950 |
-
algorithm.
|
| 1951 |
# Regenerates pipeline code whenever the holdout split size changes
|
| 1952 |
test_size.change(generate_pipeline_code, [target, algorithm, problem_type, test_size, sid], [pipeline_code])
|
| 1953 |
|
|
|
|
| 1743 |
}
|
| 1744 |
}
|
| 1745 |
|
| 1746 |
+
|
| 1747 |
+
|
| 1748 |
+
|
| 1749 |
+
/* =========================================================
|
| 1750 |
+
ML MODELING DROPDOWN POPUP FIX
|
| 1751 |
+
========================================================= */
|
| 1752 |
+
|
| 1753 |
+
/* Do not clip dropdown menus inside the glass/tabs layout. */
|
| 1754 |
+
.app-panel,
|
| 1755 |
+
#main-tabs,
|
| 1756 |
+
.tab-body {
|
| 1757 |
+
overflow: visible !important;
|
| 1758 |
+
}
|
| 1759 |
+
|
| 1760 |
+
/* Keep the active dropdown above neighboring cards/components. */
|
| 1761 |
+
#target-dropdown,
|
| 1762 |
+
#problem-type-dropdown,
|
| 1763 |
+
#algorithm-dropdown {
|
| 1764 |
+
position: relative !important;
|
| 1765 |
+
overflow: visible !important;
|
| 1766 |
+
}
|
| 1767 |
+
|
| 1768 |
+
#target-dropdown:focus-within,
|
| 1769 |
+
#problem-type-dropdown:focus-within,
|
| 1770 |
+
#algorithm-dropdown:focus-within {
|
| 1771 |
+
z-index: 2147483000 !important;
|
| 1772 |
+
}
|
| 1773 |
+
|
| 1774 |
+
/* Gradio renders the open option menu as <ul class="options">. */
|
| 1775 |
+
#target-dropdown ul.options,
|
| 1776 |
+
#problem-type-dropdown ul.options,
|
| 1777 |
+
#algorithm-dropdown ul.options {
|
| 1778 |
+
display: block !important;
|
| 1779 |
+
visibility: visible !important;
|
| 1780 |
+
opacity: 1 !important;
|
| 1781 |
+
pointer-events: auto !important;
|
| 1782 |
+
z-index: 2147483647 !important;
|
| 1783 |
+
overflow-y: auto !important;
|
| 1784 |
+
max-height: 320px !important;
|
| 1785 |
+
background: #17101d !important;
|
| 1786 |
+
border: 1px solid rgba(255, 95, 135, .28) !important;
|
| 1787 |
+
border-radius: 12px !important;
|
| 1788 |
+
box-shadow: 0 18px 50px rgba(0, 0, 0, .55) !important;
|
| 1789 |
+
}
|
| 1790 |
+
|
| 1791 |
+
/* Ensure individual choices remain visible and clickable. */
|
| 1792 |
+
#target-dropdown li[data-testid="dropdown-option"],
|
| 1793 |
+
#problem-type-dropdown li[data-testid="dropdown-option"],
|
| 1794 |
+
#algorithm-dropdown li[data-testid="dropdown-option"] {
|
| 1795 |
+
display: block !important;
|
| 1796 |
+
visibility: visible !important;
|
| 1797 |
+
opacity: 1 !important;
|
| 1798 |
+
pointer-events: auto !important;
|
| 1799 |
+
cursor: pointer !important;
|
| 1800 |
+
color: #fff7fa !important;
|
| 1801 |
+
background: #17101d !important;
|
| 1802 |
+
}
|
| 1803 |
+
|
| 1804 |
+
#target-dropdown li[data-testid="dropdown-option"]:hover,
|
| 1805 |
+
#problem-type-dropdown li[data-testid="dropdown-option"]:hover,
|
| 1806 |
+
#algorithm-dropdown li[data-testid="dropdown-option"]:hover {
|
| 1807 |
+
background: rgba(255, 95, 135, .12) !important;
|
| 1808 |
+
}
|
| 1809 |
+
|
| 1810 |
'''
|
| 1811 |
|
| 1812 |
|
|
|
|
| 1894 |
# Builds the modeling tab for target selection, training, comparison, and pipeline generation
|
| 1895 |
with gr.Tab("02. ML Modeling", id="model-lab"):
|
| 1896 |
with gr.Column(elem_classes=["tab-body"]):
|
| 1897 |
+
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>''')
|
| 1898 |
|
| 1899 |
# Groups the target, problem-type, and algorithm selectors on a single modeling row
|
| 1900 |
with gr.Row():
|
| 1901 |
+
target = gr.Dropdown(label="Target column", choices=[], value=None, interactive=True, filterable=True, elem_id="target-dropdown")
|
| 1902 |
problem_type = gr.Dropdown(
|
| 1903 |
label="Problem type",
|
| 1904 |
choices=["Auto", "classification", "regression"],
|
| 1905 |
value="Auto",
|
| 1906 |
interactive=True,
|
| 1907 |
+
filterable=True,
|
| 1908 |
+
elem_id="problem-type-dropdown",
|
| 1909 |
)
|
| 1910 |
+
algorithm = gr.Dropdown(label="Algorithm", choices=ALL_ALGORITHMS, value="Auto", interactive=True, filterable=True, elem_id="algorithm-dropdown")
|
| 1911 |
|
| 1912 |
# Configures the holdout-size control used by training, comparison, and code generation
|
| 1913 |
test_size = gr.Slider(0.1, 0.4, value=0.2, step=0.05, label="Holdout test size")
|
|
|
|
| 2009 |
|
| 2010 |
# Keep the algorithm picker and generated pipeline aligned to the selected target
|
| 2011 |
# Synchronizes model choices and generated pipeline code whenever the target selection changes
|
| 2012 |
+
target.input(sync_model_controls, [target, problem_type, algorithm, sid], [algorithm, pipeline_code, diagnostics])
|
| 2013 |
# Synchronizes model choices and generated pipeline code whenever the problem type changes
|
| 2014 |
+
problem_type.input(sync_model_controls, [target, problem_type, algorithm, sid], [algorithm, pipeline_code, diagnostics])
|
| 2015 |
# Regenerates pipeline code whenever the selected algorithm changes
|
| 2016 |
+
algorithm.input(generate_pipeline_code, [target, algorithm, problem_type, test_size, sid], [pipeline_code])
|
| 2017 |
# Regenerates pipeline code whenever the holdout split size changes
|
| 2018 |
test_size.change(generate_pipeline_code, [target, algorithm, problem_type, test_size, sid], [pipeline_code])
|
| 2019 |
|