Skip to content

Replace mock inference with real model artifacts and add input valida…#1705

Merged
omroy07 merged 1 commit intoomroy07:mainfrom
sanikaap:fix/replace-mock-inference
Mar 18, 2026
Merged

Replace mock inference with real model artifacts and add input valida…#1705
omroy07 merged 1 commit intoomroy07:mainfrom
sanikaap:fix/replace-mock-inference

Conversation

@sanikaap
Copy link
Copy Markdown
Contributor

…tion

Which issue does this PR close?

Rationale for this change

The current /predict endpoint relies on np.random.uniform(...), producing random outputs instead of deterministic, model‑based predictions. This makes the feature unreliable and unsuitable for production. By loading actual trained artifacts and encoders, we ensure consistent, meaningful results and improve user trust in the system.

What changes are included in this PR?

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

Replace random inference with deterministic predictions using encoded inputs.

Add validation for unknown crop/season/state values, returning clear error messages.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 18, 2026

@sanikaap is attempting to deploy a commit to the Om Roy's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown

Thanks for creating a PR for your Issue! ☺️

We'll review it as soon as possible.
In the meantime, please double-check the file changes and ensure that all commits are accurate.

If there are any unresolved review comments, feel free to resolve them. 🙌🏼

@omroy07 omroy07 merged commit 077a778 into omroy07:main Mar 18, 2026
2 of 5 checks passed
@github-actions
Copy link
Copy Markdown

🎉 Congrats @sanikaap on getting your PR merged! 🙌
Thanks for the contribution — looking forward to more from you 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace mock inference with real model artifacts in crop_yield_app

2 participants