A newer version of the Gradio SDK is available: 6.14.0
title: Uncensored AI Image Generator (CPU)
emoji: π¨
colorFrom: pink
colorTo: purple
sdk: gradio
python_version: 3.9
app_file: app.py
π¨ Uncensored AI Image Generator (CPU-Optimized)
This Gradio app allows generating images from text prompts using an uncensored Stable Diffusion model, optimized to run on CPU.
π Model
The app uses the Kernel/sd-nsfw model from Hugging Face. This is a Stable Diffusion v1-5 NSFW REALISM model designed for photorealistic image generation. To ensure compatibility with CPU hardware and optimize generation speed, the model is loaded with torch_dtype=torch.float32 and moved to the CPU (.to("cpu")). The built-in safety checker has been disabled to allow for uncensored image generation.
β¨ Features
- Text-to-Image Generation: Create images from any text description.
- Negative Prompt: Specify what you do not want to see in the generated image to improve quality (e.g., "low quality, blurry, distorted").
- Customizable Parameters: Control the number of inference steps and the guidance scale for finer results.
- CPU-Optimized: Designed to work without a dedicated GPU, making it ideal for Hugging Face Spaces with CPU resources.
βοΈ Local Installation & Usage
To run this app locally, follow these steps:
Clone the repository:
git clone https://github.com/YourUsername/YourRepoName cd YourRepoName(Note: This step is not necessary for Hugging Face Spaces, as you will upload the files directly.)
Create a virtual environment (optional but recommended):
python3 -m venv venv source venv/bin/activateInstall dependencies:
pip install -r requirements.txtRun the app:
python app.py
The app will then be available in your browser at http://127.0.0.1:7860/ (or a similar port).
βοΈ Deployment on Hugging Face Spaces
To deploy this app on Hugging Face Spaces, create a new Space and upload the app.py, requirements.txt, and README.md files. Make sure to select Gradio as the SDK and set the Python version to 3.9 or higher.
β οΈ Important Performance Note
Since this app runs on a CPU, image generation can take 1-2 minutes or longer, especially with a higher number of inference steps. Please be patient. For faster generation, using GPU-accelerated models is recommended.
π License
The Kernel/sd-nsfw model is licensed under the CreativeML OpenRAIL M License.