File size: 1,770 Bytes
4df495d
 
 
 
 
26003a8
4df495d
eb52c4f
4df495d
 
 
26003a8
4df495d
26003a8
 
 
 
 
4df495d
 
 
26003a8
 
4df495d
26003a8
 
 
 
 
 
 
 
 
 
 
 
 
4cd0a35
 
e4abe40
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
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("keras-dreambooth/dreambooth_kedis")
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 kedis cat as a princess with tiara"),
        gr.Textbox(label="Negative Prompt", value="bad anatomy, blurry"),
        gr.Slider(label='Number of gen image', minimum=1, maximum=4, value=2, step=1),
        gr.Slider(label="Inference Steps",value=50),
        gr.Number(label='Guidance scale', value=7.5),
    ], [
        gr.Gallery(show_label=False),
    ],
    title="Dreambooth Kedis",
    description = "This dreambooth model is fine-tuned on my cat, Kediş (meaning, kitten in Turkish). She's a tabby cat I adopted on a stormy day in the street. You can prompt using the special indicator {kedis cat}.",
    examples = [["photo of kedis cat as astronaut, high quality, blender, 3d, trending on artstation, 8k", "bad, ugly", 1, 50, 7.5],
               ["kedis cat as a princess with tiara", "bad, ugly", 2, 50, 7.5]], cache_examples=True
    ).queue().launch()