Bb / 🎨 Uncensored AI Image Generator (CPU-Optimized).md
drdudddd's picture
Upload 3 files
5224c49 verified

A newer version of the Gradio SDK is available: 6.14.0

Upgrade
metadata
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:

  1. 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.)

  2. Create a virtual environment (optional but recommended):

    python3 -m venv venv
    source venv/bin/activate
    
  3. Install dependencies:

    pip install -r requirements.txt
    
  4. Run 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.