File size: 885 Bytes
e83b3b3
 
 
 
 
 
 
 
 
4fd98d5
7390e09
 
 
 
e83b3b3
 
 
 
 
 
 
c7f445d
 
 
3b7161f
c7f445d
e83b3b3
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
import gradio as gr

def greet(name):
    return "Hello " + name + "!!"

def produce_art(prompt):
    from diffusers import StableDiffusionPipeline
    import torch

    model_id = "atsyplikhin/rita_sd_model"
    if torch.cuda.is_available():
        pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda")
    else:
        pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32)

    bs = 1
    images = pipe([prompt]*bs, num_inference_steps=50, guidance_scale=7.5)
    # [images.images[i].save(f"rita-stalin-kefir{i+j*bs}.png") for i in range(bs)]
    return images.images[0]

prompt = "RitaT style collage of Stalin with Kefir in outer space, fine details trending on arthouse"

iface = gr.Interface(fn=produce_art, 
    inputs=gr.Textbox(value=prompt), 
    outputs=gr.Image(shape=(512, 512))
    )
iface.launch()