import React, { useState } from "react"; import axios from "axios"; const ImageGenerator = () => { const [prompt, setPrompt] = useState(""); const [imageUrl, setImageUrl] = useState(""); const handleGenerateImage = async () => { try { const res = await axios.post("http://localhost:8000/generate-image", { prompt, }); setImageUrl(res.data.image_url); } catch (error) { console.error("Error generating image:", error); } }; return (