Leverage state-of-the-art AI models to generate stunning images from textual descriptions.
This project uses Hugging Face's Stable Diffusion Pipeline to generate high-quality images based on user-provided text prompts. It showcases the seamless integration of AI tools for creative and functional purposes.
The project utilizes the StableDiffusionPipeline
from Hugging Face's diffusers
library. This pre-trained model is fine-tuned for generating detailed and realistic images from textual
descriptions.
float32
(CPU) and
float16
(MPS) precision for faster computation.
Users input prompts directly into the Streamlit app. The prompt is validated and passed to the Stable
Diffusion
model. For demonstration purposes, a default prompt is provided:
"A photograph of an astronaut riding a horse on Mars."
The application is built using Streamlit
, which provides a responsive web interface. Key
technical
details:
CPU
and MPS
for
model
inference.@st.cache_resource
ensures that the pipeline is loaded only once
per
session, significantly reducing runtime overhead.The image generation process follows these steps:
To ensure smooth and efficient image generation:
float16
on MPS devices to optimize memory
usage and reduce inference time.Below is an example of a generated image based on the prompt: "A photograph of an astronaut riding a horse on Mars."
Access the complete code, app, and documentation here: GitHub Repository
Developed by Aryan Singh. Explore the full implementation on GitHub.