Skip to content

Replace mock inference with real model artifacts in crop_yield_app #1704

@sanikaap

Description

@sanikaap

Describe the bug

The Flask app currently uses YieldModel with np.random.uniform(...), so predictions are random and not based on actual trained artifacts. This makes the feature unreliable and not production‑ready.

To Reproduce

Load the real model and encoders (xgb_crop_model.pkl, Crop_encoder.pkl, Season_encoder.pkl, State_encoder.pkl).

Use properly encoded inputs for inference in /predict.

Handle unknown crop/season/state values with clear validation errors.

Ensure the existing /download_report flow continues to work.

Expected behavior

Same input returns deterministic, model‑based output (not random).

/predict uses loaded artifacts successfully.

Invalid categorical inputs return user‑friendly error messages.

No regression in existing form submission and report download behavior.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ECWoC26bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions