Spaces:
Runtime error
Runtime error
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("bharat-raghunathan/dreambooth_dosa") | |
sd_dreambooth_model._diffusion_model = db_diffusion_model | |
gr.HTML("<h2 style=\"font-size: 2em; font-weight: bold\" align=\"center\">Keras Dreambooth - The Humble Dosa</h2>") | |
gr.HTML("<p style=\"font-size: 14; font-weight: normal\" align=\"left\">This model has been fine-tuned to learn the concept of a dosa.") | |
# generate images | |
def infer(prompt): | |
generated_images = sd_dreambooth_model.text_to_image( | |
prompt | |
) | |
return generated_images | |
output = gr.Gallery(label="Outputs").style(grid=(2,2)) | |
gr.Examples(["realistic picture of a man eating a dosa", | |
"realistic picture of a dosa on a plate", | |
"realistic picture of a dosa in a restaurant" | |
], | |
prompt, gallery, generate_images, cache_examples=True) | |
gr.Markdown('Demo created by [Bharat Raghunathan](https://huggingface.co/bharat-raghunathan/)') | |
# pass function, input type for prompt, the output for multiple images | |
gr.Interface(infer, inputs=["text"], outputs=[output]).launch() |