File size: 999 Bytes
f41c220
6b1633c
32b2b28
f41c220
6e0823f
 
 
32b2b28
f41c220
86cdd5d
 
 
6e0823f
 
 
 
86cdd5d
32b2b28
b0fc705
 
86cdd5d
 
 
6e0823f
 
 
 
86cdd5d
b0fc705
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import gradio as gr
import torch
from diffusers import DiffusionPipeline

def generate(
    prompt, negative_prompt, num_inference_steps, width, height, guidance_scale
):
    pipeline = DiffusionPipeline.from_pretrained("Lykon/DreamShaper")

    return pipeline(
        prompt=prompt,
        negative_prompt=negative_prompt,
        num_inference_steps=num_inference_steps,
        width=width,
        height=height,
        guidance_scale=guidance_scale,
    ).images[0]

iface = gr.Interface(
    fn=generate,
    inputs=[
        gr.Textbox(label="Prompt", value=""),
        gr.Textbox(label="Negative Prompt", value=""),
        gr.Slider(label="Sampling Steps", minimum=1, maximum=150, value=30, step=1),
        gr.Slider(label="Width", minimum=64, maximum=2048, value=512, step=1),
        gr.Slider(label="Height", minimum=64, maximum=2048, value=512, step=1),
        gr.Slider(label="CFG Scale", minimum=1, maximum=30, value=9, step=0.5),
    ],
    outputs="image",
)

iface.launch()