Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -1715,15 +1715,15 @@ html, body {
|
|
| 1715 |
align-items: center !important;
|
| 1716 |
justify-content: center !important;
|
| 1717 |
width: auto !important;
|
| 1718 |
-
min-width:
|
| 1719 |
-
max-width:
|
| 1720 |
-
min-height:
|
| 1721 |
margin: 0 !important;
|
| 1722 |
-
padding:
|
| 1723 |
flex: 0 0 auto !important;
|
| 1724 |
text-align: center !important;
|
| 1725 |
white-space: nowrap !important;
|
| 1726 |
-
font-size:
|
| 1727 |
border-radius: 9px !important;
|
| 1728 |
color: #9e93a5 !important;
|
| 1729 |
}
|
|
@@ -2043,13 +2043,15 @@ ul.options[role="listbox"] {
|
|
| 2043 |
text-align: center !important;
|
| 2044 |
}
|
| 2045 |
|
| 2046 |
-
/* Primary tabs: give the long ML Modeling label more room and allow wrapping.
|
|
|
|
|
|
|
| 2047 |
@media (min-width: 801px) {
|
| 2048 |
#main-tabs [role="tablist"] {
|
| 2049 |
grid-template-columns:
|
| 2050 |
minmax(0, 0.88fr)
|
| 2051 |
-
minmax(0,
|
| 2052 |
-
minmax(0,
|
| 2053 |
gap: 14px !important;
|
| 2054 |
}
|
| 2055 |
|
|
@@ -2272,8 +2274,29 @@ def build_app():
|
|
| 2272 |
schema_table = gr.Dataframe(label="Dataset Schema:", interactive=False, wrap=True, elem_id="dataset-schema")
|
| 2273 |
gr.HTML(f'''<div class="info-note"><strong>HF sample:</strong> <code>{EXAMPLE_DATASET_REPO}</code> · target <code>{EXAMPLE_DATASET_TARGET}</code>. Public Space: do not upload confidential, regulated, proprietary, production customer, or PII data.</div>''')
|
| 2274 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2275 |
# Builds the modeling tab for target selection, training, comparison, and pipeline generation
|
| 2276 |
-
with gr.Tab("
|
| 2277 |
with gr.Column(elem_classes=["tab-body"]):
|
| 2278 |
gr.HTML('''<div class="section-head"><div class="section-kicker">Supervised Learning</div><h2>Choose a Target Variable (Feature), Algorithm, and Evaluation Setup</h2><p>Build a preprocessing + model pipeline, evaluate it on a holdout split, compare baselines, and evaluate generated pipelines (scikit-learn pipelines).</p></div>''')
|
| 2279 |
|
|
@@ -2332,27 +2355,6 @@ def build_app():
|
|
| 2332 |
pipeline_code = gr.Code(label="Selected Algorithm Pipeline", language="python", lines=30)
|
| 2333 |
model_artifact = gr.File(label="Trained Pipeline Artifact (.joblib)", interactive=False)
|
| 2334 |
|
| 2335 |
-
# Builds the agent tab for natural-language ML tasks, generated code, and tool-trace inspection
|
| 2336 |
-
with gr.Tab("03. ML Agent", id="agent"):
|
| 2337 |
-
with gr.Column(elem_classes=["tab-body"]):
|
| 2338 |
-
gr.HTML('''<div class="section-head"><div class="section-kicker">Machine Learning Agent</div><h2>Turn Dataset Findings Into an ML Strategy and Pipeline Code (sci-kit learn)</h2><p>Agent can inspect the dataset, validate the target framing, train the selected model, compare baselines, and generate scikit-learn pipelines.</p></div>''')
|
| 2339 |
-
# Configures the agent task prompt field with a comprehensive default machine-learning request
|
| 2340 |
-
task = gr.Textbox(
|
| 2341 |
-
label="Machine learning task",
|
| 2342 |
-
value="Audit this dataset for supervised machine learning, confirm the target framing, train a baseline model, compare appropriate algorithms, explain the evaluation metrics, flag leakage or data risks, and generate a production-oriented scikit-learn pipeline.",
|
| 2343 |
-
placeholder="Example: Predict customer churn, compare baseline classifiers, prioritize recall, and generate a deployable preprocessing + model pipeline.",
|
| 2344 |
-
lines=6,
|
| 2345 |
-
max_lines=12,
|
| 2346 |
-
)
|
| 2347 |
-
# Creates the agent execution button and result components for answers, code, and tool traces
|
| 2348 |
-
agent_btn = gr.Button("Run Machine Learning Agent", variant="primary", elem_id="agent-button")
|
| 2349 |
-
agent_answer = gr.Markdown("", elem_id="agent-answer", elem_classes=["result-markdown"])
|
| 2350 |
-
with gr.Tabs(elem_id="agent-result-tabs", elem_classes=["result-tabs"]):
|
| 2351 |
-
with gr.Tab("Recommended Pipeline"):
|
| 2352 |
-
agent_code = gr.Code(label="Generated Python", language="python", lines=28)
|
| 2353 |
-
with gr.Tab("Tool Trace"):
|
| 2354 |
-
trace = gr.JSON(label="Agent tool calls and observations")
|
| 2355 |
-
|
| 2356 |
# Builds the sidebar containing live workspace status, runtime information, controls, and diagnostics
|
| 2357 |
with gr.Column(scale=4, min_width=335, elem_classes=["side-column"]):
|
| 2358 |
status = gr.HTML(_status(None))
|
|
|
|
| 1715 |
align-items: center !important;
|
| 1716 |
justify-content: center !important;
|
| 1717 |
width: auto !important;
|
| 1718 |
+
min-width: 170px !important;
|
| 1719 |
+
max-width: 270px !important;
|
| 1720 |
+
min-height: 46px !important;
|
| 1721 |
margin: 0 !important;
|
| 1722 |
+
padding: 10px 22px !important;
|
| 1723 |
flex: 0 0 auto !important;
|
| 1724 |
text-align: center !important;
|
| 1725 |
white-space: nowrap !important;
|
| 1726 |
+
font-size: 17px !important;
|
| 1727 |
border-radius: 9px !important;
|
| 1728 |
color: #9e93a5 !important;
|
| 1729 |
}
|
|
|
|
| 2043 |
text-align: center !important;
|
| 2044 |
}
|
| 2045 |
|
| 2046 |
+
/* Primary tabs: give the long ML Modeling label more room and allow wrapping.
|
| 2047 |
+
(Column ratios follow content, not position: 02 is now the short "ML Agent"
|
| 2048 |
+
label and 03 is the long "ML Modeling (Optional Fallback Models)" label.) */
|
| 2049 |
@media (min-width: 801px) {
|
| 2050 |
#main-tabs [role="tablist"] {
|
| 2051 |
grid-template-columns:
|
| 2052 |
minmax(0, 0.88fr)
|
| 2053 |
+
minmax(0, 0.88fr)
|
| 2054 |
+
minmax(0, 1.24fr) !important;
|
| 2055 |
gap: 14px !important;
|
| 2056 |
}
|
| 2057 |
|
|
|
|
| 2274 |
schema_table = gr.Dataframe(label="Dataset Schema:", interactive=False, wrap=True, elem_id="dataset-schema")
|
| 2275 |
gr.HTML(f'''<div class="info-note"><strong>HF sample:</strong> <code>{EXAMPLE_DATASET_REPO}</code> · target <code>{EXAMPLE_DATASET_TARGET}</code>. Public Space: do not upload confidential, regulated, proprietary, production customer, or PII data.</div>''')
|
| 2276 |
|
| 2277 |
+
# Builds the agent tab for natural-language ML tasks, generated code, and tool-trace inspection
|
| 2278 |
+
with gr.Tab("02. ML Agent", id="agent"):
|
| 2279 |
+
with gr.Column(elem_classes=["tab-body"]):
|
| 2280 |
+
gr.HTML('''<div class="section-head"><div class="section-kicker">Machine Learning Agent</div><h2>Turn Dataset Findings Into an ML Strategy and Pipeline Code (sci-kit learn)</h2><p>Agent can inspect the dataset, validate the target framing, train the selected model, compare baselines, and generate scikit-learn pipelines.</p></div>''')
|
| 2281 |
+
# Configures the agent task prompt field with a comprehensive default machine-learning request
|
| 2282 |
+
task = gr.Textbox(
|
| 2283 |
+
label="Machine learning task",
|
| 2284 |
+
value="Audit this dataset for supervised machine learning, confirm the target framing, train a baseline model, compare appropriate algorithms, explain the evaluation metrics, flag leakage or data risks, and generate a production-oriented scikit-learn pipeline.",
|
| 2285 |
+
placeholder="Example: Predict customer churn, compare baseline classifiers, prioritize recall, and generate a deployable preprocessing + model pipeline.",
|
| 2286 |
+
lines=6,
|
| 2287 |
+
max_lines=12,
|
| 2288 |
+
)
|
| 2289 |
+
# Creates the agent execution button and result components for answers, code, and tool traces
|
| 2290 |
+
agent_btn = gr.Button("Run Machine Learning Agent", variant="primary", elem_id="agent-button")
|
| 2291 |
+
agent_answer = gr.Markdown("", elem_id="agent-answer", elem_classes=["result-markdown"])
|
| 2292 |
+
with gr.Tabs(elem_id="agent-result-tabs", elem_classes=["result-tabs"]):
|
| 2293 |
+
with gr.Tab("Recommended Pipeline"):
|
| 2294 |
+
agent_code = gr.Code(label="Generated Python", language="python", lines=28)
|
| 2295 |
+
with gr.Tab("Tool Trace"):
|
| 2296 |
+
trace = gr.JSON(label="Agent tool calls and observations")
|
| 2297 |
+
|
| 2298 |
# Builds the modeling tab for target selection, training, comparison, and pipeline generation
|
| 2299 |
+
with gr.Tab("03. ML Modeling (Optional Fallback Models)", id="model-lab"):
|
| 2300 |
with gr.Column(elem_classes=["tab-body"]):
|
| 2301 |
gr.HTML('''<div class="section-head"><div class="section-kicker">Supervised Learning</div><h2>Choose a Target Variable (Feature), Algorithm, and Evaluation Setup</h2><p>Build a preprocessing + model pipeline, evaluate it on a holdout split, compare baselines, and evaluate generated pipelines (scikit-learn pipelines).</p></div>''')
|
| 2302 |
|
|
|
|
| 2355 |
pipeline_code = gr.Code(label="Selected Algorithm Pipeline", language="python", lines=30)
|
| 2356 |
model_artifact = gr.File(label="Trained Pipeline Artifact (.joblib)", interactive=False)
|
| 2357 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2358 |
# Builds the sidebar containing live workspace status, runtime information, controls, and diagnostics
|
| 2359 |
with gr.Column(scale=4, min_width=335, elem_classes=["side-column"]):
|
| 2360 |
status = gr.HTML(_status(None))
|