Spaces:
Build error
Build error
| import { TrainingMonitor } from '../../lib/training-monitor'; | |
| export default function handler(req, res) { | |
| if (req.method !== 'POST') { | |
| return res.status(405).json({ error: 'Method not allowed' }); | |
| } | |
| try { | |
| const monitor = new TrainingMonitor(); | |
| // Simulate training for demo | |
| for (let epoch = 0; epoch < 10; epoch++) { | |
| monitor.logEpoch(epoch, Math.random() * 0.5, 0.001 * Math.pow(0.9, epoch)); | |
| } | |
| res.status(200).json({ history: monitor.history }); | |
| } catch (error) { | |
| console.error('Training error:', error); | |
| res.status(500).json({ error: 'Training failed' }); | |
| } | |
| } |