merve's picture
merve HF Staff
Update app.py
ecd6c3e
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()