Abiru's picture
Update app.py
f06640e verified
raw
history blame contribute delete
920 Bytes
import gradio as gr
from diffusers import DiffusionPipeline
import random
import spaces
pipe = DiffusionPipeline.from_pretrained("UnfilteredAI/NSFW-gen-v2")
def generate(prompt, negative_prompt, num_inference_steps, guidance_scale, width, height, num_samples):
return pipe(
prompt=prompt,
negative_prompt=negative_prompt,
num_inference_steps=num_inference_steps,
guidance_scale=guidance_scale,
width=width,
height=height,
num_images_per_prompt=num_samples
).images
gr.Interface(
fn=generate,
inputs=[
gr.Text(label="Prompt"),
gr.Text("", label="Negative Prompt"),
gr.Number(7, label="Number inference steps"),
gr.Number(3, label="Guidance scale"),
gr.Number(512, label="Width"),
gr.Number(512, label="Height"),
gr.Number(1, label="# images"),
],
outputs=gr.Gallery(),
).launch()