import { useState } from 'react'; import axios from 'axios'; import { ArrowRight } from 'lucide-react'; export default function Form({ setResult, setLoading }) { const [formData, setFormData] = useState({ gender: 'Male', married: 'No', dependents: '0', education: 'Graduate', self_employed: 'No', applicant_income: 5000, coapplicant_income: 0, loan_amount: 100, loan_amount_term: 360, credit_history: 1.0, property_area: 'Urban' }); const handleChange = (e) => { const { name, value } = e.target; setFormData(prev => ({ ...prev, [name]: ['applicant_income', 'coapplicant_income', 'loan_amount', 'loan_amount_term', 'credit_history'].includes(name) ? parseFloat(value) : value })); }; const handleSubmit = async (e) => { e.preventDefault(); setLoading(true); try { const response = await axios.post('/api/predict', formData); setResult(response.data); } catch (error) { console.error("Prediction error", error); alert('Error predicting. Make sure backend is running.'); } finally { setLoading(false); } }; return (