File size: 1,256 Bytes
3bd39c3
851d258
aa90372
 
 
3bd39c3
0f648d1
 
09bd06d
8bf10b5
 
aa90372
 
963ae47
 
 
 
 
 
 
 
 
aa90372
8bf10b5
aa90372
 
 
 
 
b16dcce
963ae47
 
b16dcce
aa90372
 
44f1bc6
 
 
 
 
 
 
 
 
 
 
8f03093
44f1bc6
8bf10b5
c548ada
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import gradio as gr
import os
import spaces
import torch
from diffusers import DiffusionPipeline

pipe = DiffusionPipeline.from_pretrained("segmind/tiny-sd")
pipe.load_lora_weights(
    "philipp-zettl/jon_juarez-lora",
    hf_token=os.environ.get('HF_TOKEN')
)
pipe.to('cuda')
@spaces.GPU
def generate(prompt, negative_prompt, num_inference_steps, width, height, num_samples):
    return pipe(
        prompt,
        negative_prompt=negative_prompt,
        num_inference_steps=num_inference_steps,
        width=width,
        height=height,
        num_images_per_prompt=num_samples
    ).images


app = gr.Interface(
    fn=generate,
    inputs=[
        gr.Text(label="Prompt"),
        gr.Text("", label="Negative Prompt"),
        gr.Slider(minimum=1, maximum=100, value=45, label="Number inference steps"),
        gr.Number(512, label='Image width'),
        gr.Number(512, label='Image height'),
        gr.Slider(minimum=1, maximum=10, value=1, label='Number samples'),
    ],
    outputs=gr.Gallery(),
    examples=[
        [
            "Colorful line shading by JON_JUAREZ a dark cave with toxic mushrooms",
            "",
            45,
            512,
            512,
            1
        ]
        
        
    ]
)
    
app.launch()