File size: 1,794 Bytes
211fa61
99027bc
 
 
 
 
 
cb492a7
99027bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ecd6c3e
 
cf5cbd2
ecd6c3e
 
99027bc
 
 
a80b8c0
99027bc
ecd6c3e
a031c23
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
from huggingface_hub import from_pretrained_keras
from keras_cv import models
import gradio as gr

sd_dreambooth_model = models.StableDiffusion(
    img_width=512, img_height=512
)
db_diffusion_model = from_pretrained_keras("merve/dreambooth_bioshock_v2")
sd_dreambooth_model._diffusion_model = db_diffusion_model

# generate images
def infer(prompt, negative_prompt, num_imgs_to_gen, num_steps, guidance_scale):
    generated_images = sd_dreambooth_model.text_to_image(
        prompt,
        negative_prompt=negative_prompt,
        batch_size=num_imgs_to_gen,
        num_steps=num_steps,
        unconditional_guidance_scale=guidance_scale
    )
    return generated_images 
    
    
# output = gr.Gallery(label="Outputs").style(grid=(2,2))

# pass function, input type for prompt, the output for multiple images
gr.Interface(
    infer, [
        gr.Textbox(label="Positive Prompt", value="a cafe in sks bskscnry style, rendered in unreal engine, trending on art station, 8k, hyperfocus, hyperrealistic, saturated colors, art deco"),
        gr.Textbox(label="Negative Prompt", value="ugly, low quality, blurry"),
        gr.Slider(label='Number of gen image', minimum=1, maximum=4, value=1, step=1),
        gr.Slider(label="Inference Steps",value=100),
        gr.Number(label='Guidance scale', value=10),
    ], [
        gr.Gallery(show_label=False),
    ],
    title="Dreambooth Bioshock",
    description = "This is a dreambooth model fine-tuned on images of Bioshock sceneries. To play with the demo, input the concept with {sks bskscnry}.",
    examples = [["a cafe in sks bskscnry style, rendered in unreal engine, trending on art station, 8k, hyperfocus, hyperrealistic, saturated colors, art deco", "ugly, low quality, blurry", 2, 100, 7.5]],
    cache_examples=True).launch()