gigant/oldbookillustrations
Viewer • Updated • 4.15k • 885 • 41
How to use alibidaran/dreambooth-old-book-illustration with Diffusers:
pip install -U diffusers transformers accelerate
import torch
from diffusers import DiffusionPipeline
# switch to "mps" for apple devices
pipe = DiffusionPipeline.from_pretrained("alibidaran/dreambooth-old-book-illustration", dtype=torch.bfloat16, device_map="cuda")
prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
image = pipe(prompt).images[0]This model is fined-tuned version of StableDiffusion model via Dreambooth. The code below is for the direct usage and controlling the model for making a more cohesive image based on the given prompt.
image_format='Portrat (Tall)'
image_subject='Narratives'
book_title='Ballads and songs of Brittany'
date='1833'
prompt=f"""
<image> generate image with theme of {date} with illustration format {image_format} of and subject of {image_subject}.
The generating image should be inspired from {book_title}.
## Image description:
Two men are drinking wine in the Bar.
"""
num_samples = 2
num_rows = 1
all_images = []
for _ in range(num_rows):
images = pipe(prompt, num_images_per_prompt=num_samples, num_inference_steps=50, guidance_scale=9).images
all_images.extend(images)
grid = image_grid(all_images, num_rows, num_samples)
grid