File size: 415 Bytes
6001e3c
6bc9074
e845246
6bc9074
6001e3c
6bc9074
 
e845246
 
 
 
6bc9074
 
 
 
8af010c
6bc9074
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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')

@spaces.GPU
def generate(prompt):
    return pipe(prompt, num_inference_steps=45).images

gr.Interface(
    fn=generate,
    inputs=gr.Text(),
    outputs=gr.Gallery(),
).launch()