import { useState } from 'react'; import { Image as ImageIcon, Loader2, Sparkles } from 'lucide-react'; export default function ComfyUI() { const [prompt, setPrompt] = useState(''); const [loading, setLoading] = useState(false); const [imageUrl, setImageUrl] = useState(''); const [error, setError] = useState(''); const handleGenerate = async () => { if (!prompt.trim()) return; setLoading(true); setError(''); setImageUrl(''); try { const response = await fetch('/api/comfy', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ prompt }), }); if (!response.ok) throw new Error('Failed to generate image'); const data = await response.json(); setImageUrl(data.url); } catch (err) { setError(err.message || 'Something went wrong'); } finally { setLoading(false); } }; return (

ComfyUI Image Gen