File size: 846 Bytes
99ce383 da323ae 99ce383 da323ae 99ce383 |
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 |
from huggingface_hub import from_pretrained_keras
from keras_cv import models
import gradio as gr
# prepare model
resolution = 512
sd_dreambooth_model = models.StableDiffusion(
img_width=resolution, img_height=resolution, jit_compile=True,
)
db_diffusion_model = from_pretrained_keras("merve/dreambooth_diffusion_model")
sd_dreambooth_model._diffusion_model = db_diffusion_model
# generate images
def infer(prompt):
generated_images = sd_dreambooth_model.text_to_image(
prompt, batch_size=9
)
return generated_images
output = gr.Gallery(label="Outputs").style(grid=(3,3))
# customize interface
title = "Dreambooth Demo on Dog Images"
description = "This is a dreambooth model fine-tuned on dog images. To try it, input the concept with {sks dog}."
gr.Interface(infer, inputs=["text"], outputs=[output]).launch() |