import React, { useState } from "react"; import Api from './api'; const Original = () => { const [loading, setLoading] = useState(false); const [output, setOutput] = useState(null); const handleSubmit = async (event) => { event.preventDefault(); setLoading(true); const input = event.target.elements.input.value; const response = await fetch( "https://79c67b7467ac6c1889.gradio.live/", { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${Api}`, }, body: JSON.stringify({ inputs: input, }), } ); if (!response.ok) { throw new Error("Failed to generate image"); } const blob = await response.blob(); setOutput(URL.createObjectURL(blob)); setLoading(false); }; return (

Stable Diffusion

Pellentesque vulputate dignissim enim, et sollicitudin massa pellentesque ut. Proin luctus dui ut sem varius eleifend.

{loading &&
Loading...
} {!loading && output && (
art
)}
); }; export default Original;