2 Commits

2 changed files with 29 additions and 26 deletions
+28 -26
View File
@@ -45,32 +45,34 @@ const Ai = () => {
}; };
return ( return (
<div className="max-w-md mx-auto p-6 bg-white shadow rounded-lg"> <div className="min-h-screen w-full flex items-center justify-center max-h-screen">
<h2 className="text-2xl font-bold mb-4 text-center"> <div className="max-w-md mx-auto p-6 bg-white shadow rounded-lg">
Plant disease prediction <h2 className="text-2xl font-bold mb-4 text-center">
</h2> Plant disease prediction
<form onSubmit={handleSubmit} className="space-y-4"> </h2>
<input <form onSubmit={handleSubmit} className="space-y-4">
type="file" <input
accept="image/*" type="file"
onChange={handleFileChange} accept="image/*"
className="block w-full text-sm text-gray-900 border border-gray-300 rounded-lg cursor-pointer bg-gray-50 p-2" onChange={handleFileChange}
/> className="block w-full text-sm text-gray-900 border border-gray-300 rounded-lg cursor-pointer bg-gray-50 p-2"
<button />
type="submit" <button
disabled={loading || !selectedFile} type="submit"
className="w-full bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded focus:outline-none focus:ring-2 focus:ring-blue-500" disabled={loading || !selectedFile}
> className="w-full bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded focus:outline-none focus:ring-2 focus:ring-blue-500"
{loading ? "Predicting..." : "Predict"} >
</button> {loading ? "Predicting..." : "Predict"}
</form> </button>
{error && <p className="mt-4 text-center text-red-600">{error}</p>} </form>
{prediction && ( {error && <p className="mt-4 text-center text-red-600">{error}</p>}
<div className="mt-4 p-4 bg-green-100 border border-green-300 rounded"> {prediction && (
<h3 className="text-lg font-semibold">Prediction:</h3> <div className="mt-4 p-4 bg-green-100 border border-green-300 rounded">
<p>{prediction}</p> <h3 className="text-lg font-semibold">Prediction:</h3>
</div> <p>{prediction}</p>
)} </div>
)}
</div>
</div> </div>
); );
}; };
+1
View File
@@ -4,3 +4,4 @@ Bhakti's frontend branch.
--- ---
⚠️⚠️ DO NOT PUSH TO THIS BRANCH, IT HAS BEEN LOCKED SINCE ALL THE CHANGES ARE MERGED WITH MAIN BRANCH. TO MAKE CHANGES, CREATE A NEW FEATURE BRANCH DERIVED FROM `main` BRANCH AND CREATE A NEW PULL REQUEST. ⚠️⚠️