import React, { useState, useEffect } from "react"; import axios from "axios"; import { ChakraProvider, Container, Heading, Text, Input, Button, Wrap, Link, } from "@chakra-ui/react"; // Import Chakra UI components import "./Gallery.css"; // Import your Gallery CSS here const Gallery = ({ images }) => { return (
{images.map((image, index) => ( {`Image ))}
); }; const App = () => { const [image, updateImage] = useState(); const [prompt, updatePrompt] = useState(""); const [loading, updateLoading] = useState(false); const [showGallery, setShowGallery] = useState(false); const [galleryImages, setGalleryImages] = useState([]); const generate = async (prompt) => { updateLoading(true); const result = await axios.get(`http://127.0.0.1:8000/?prompt=${prompt}`); updateImage(result.data); updateLoading(false); }; useEffect(() => { // Fetch image filenames from the backend API when the component mounts axios.get("http://127.0.0.1:8000/api/get_images").then((response) => { setGalleryImages(response.data); }); }, []); return ( 70年小人书: Vintage Chinese Comics Generator Click on the generate button to generate an image from a Stable Diffusion 1.5 model trained on vintage Chinese comics. This is an all-ages friendly, SFW model. If NSFW content is detected, the generated image will return as a black square. If that happens, just try again.{" "} Original SD 1.5 Github Repo Huggingface Repo for this model frontend and backend code based on Nicholas Renotte's repo updatePrompt(e.target.value)} width={"350px"} > {loading ? (
Loading...
) : image ? (
Generated
{showGallery && }
) : null}
); }; export default App;