Spaces:
Running
on
Zero
Running
on
Zero
import gradio as gr | |
import spaces | |
import torch | |
from diffusers import DiffusionPipeline | |
model_name = 'UnfilteredAI/NSFW-gen-v2' | |
pipe = DiffusionPipeline.from_pretrained( | |
model_name, | |
torch_dtype=torch.float16 | |
) | |
pipe.to('cuda') | |
def generate(prompt): | |
return pipe(prompt, num_inference_steps=45).images | |
gr.Interface( | |
fn=generate, | |
inputs=gr.Text(), | |
outputs=gr.Gallery(), | |
).launch() |