File size: 702 Bytes
1b2b4ae
8456a34
1b2b4ae
 
8456a34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
from diffusers import StableDiffusionPipeline
import torch

# Load the uncensored model (change to any other if needed)
pipe = StableDiffusionPipeline.from_pretrained(
    "nolanaat/sd-nsfw",  # Uncensored NSFW model
    torch_dtype=torch.float32
)

# Move to CPU (or use .to("cuda") if you're on GPU)
pipe = pipe.to("cpu")

def generate(prompt):
    image = pipe(prompt, guidance_scale=7.5).images[0]
    return image

gr.Interface(
    fn=generate,
    inputs=gr.Textbox(label="Enter your prompt"),
    outputs=gr.Image(type="pil"),
    title="NSFW Uncensored Text-to-Image Generator (CPU)",
    description="Based on nolanaat/sd-nsfw — runs on CPU (slow, but works)"
).launch()