Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -81,13 +81,23 @@ def predict_linear(strain, dose, soil_n, soil_p, soil_k, ph,
|
|
| 81 |
# -----------------------------
|
| 82 |
# 4️⃣ Gradio Interface
|
| 83 |
# -----------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
with gr.Blocks(title="Linear Regression Plant Predictor") as demo:
|
| 85 |
gr.Markdown("<h1 style='text-align:center'>Linear Regression — Plant Yield Predictor</h1>")
|
| 86 |
|
| 87 |
with gr.Row():
|
| 88 |
with gr.Column(scale=1):
|
| 89 |
gr.Markdown("### Plant & Strain")
|
| 90 |
-
strain_input = gr.Dropdown(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
row_selector = gr.Dropdown(row_options, label="Select Row", value="None, Enter Manually")
|
| 92 |
|
| 93 |
gr.Markdown("### Input Parameters")
|
|
|
|
| 81 |
# -----------------------------
|
| 82 |
# 4️⃣ Gradio Interface
|
| 83 |
# -----------------------------
|
| 84 |
+
invalid_strains = ["Strains", "strain1", "strain2", ""]
|
| 85 |
+
valid_strain = next(
|
| 86 |
+
(s for s in strain_names if pd.notna(s) and s not in invalid_strains),
|
| 87 |
+
strain_names[0] # fallback if none found
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
with gr.Blocks(title="Linear Regression Plant Predictor") as demo:
|
| 91 |
gr.Markdown("<h1 style='text-align:center'>Linear Regression — Plant Yield Predictor</h1>")
|
| 92 |
|
| 93 |
with gr.Row():
|
| 94 |
with gr.Column(scale=1):
|
| 95 |
gr.Markdown("### Plant & Strain")
|
| 96 |
+
strain_input = gr.Dropdown(
|
| 97 |
+
strain_names,
|
| 98 |
+
label="Select Strain",
|
| 99 |
+
value=valid_strain # first valid, non-NaN, non-invalid strain
|
| 100 |
+
)
|
| 101 |
row_selector = gr.Dropdown(row_options, label="Select Row", value="None, Enter Manually")
|
| 102 |
|
| 103 |
gr.Markdown("### Input Parameters")
|