|
|
import gradio as gr |
|
|
from diffusers import StableDiffusionPipeline |
|
|
import torch |
|
|
|
|
|
|
|
|
pipe = StableDiffusionPipeline.from_pretrained( |
|
|
"nolanaat/sd-nsfw", |
|
|
torch_dtype=torch.float32 |
|
|
) |
|
|
|
|
|
|
|
|
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() |