File size: 1,817 Bytes
69f6fc2
ae23482
78ed83d
2f0087d
78ed83d
69f6fc2
 
b6badad
b88c59f
 
 
69f6fc2
ae23482
 
 
69f6fc2
78ed83d
 
a032108
 
ae23482
69f6fc2
a032108
 
 
ae23482
 
 
a032108
ae23482
a032108
ae23482
 
 
a032108
ae23482
 
 
 
 
 
 
 
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
41
42
43
44
#!/usr/bin/env python3
from diffusers import StableDiffusionPipeline, DDIMScheduler
import time
import os
from huggingface_hub import HfApi
import torch
import sys
from pathlib import Path
import requests
from PIL import Image
from io import BytesIO

begin = ["a picture of <rickmann>", "a photo of <rickmann>", "The <rickmann>", "an image of <rickmann>"]
mid = ["", " on a bike", " with sunglasses", " at the beach", " in front of a mountain", " in the water", " on a boat", " at a fashion show", " as a superstar model", " while it snows", " in a forest", " with a nice landscape"]
end = ["", " , disco light style", ", minecraft style", " , picasso style", " as a lego person", ""]

api = HfApi()
start_time = time.time()
path = "patrickvonplaten/papa_out_5"
pipe = StableDiffusionPipeline.from_pretrained(path, safety_checker=None, torch_dtype=torch.float16)
pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
pipe = pipe.to("cuda")
counter = 0

for b in begin:
    for m in mid:
        for e in end:
            prompt = b + mid + e + ", highly realistic, super resolution, high quality photography, beautiful"

            images = pipe(prompt=prompt, num_images_per_prompt=2, eta=1.0, negative_prompt="ugly, bad quality, deformed", num_inference_steps=50).images

            for i, image in enumerate(images):
                path = os.path.join(Path.home(), "papa", f"{counter}.png")
                image.save(path)

                api.upload_file(
                    path_or_fileobj=path,
                    path_in_repo=path.split("/")[-1],
                    repo_id="patrickvonplaten/papa",
                    repo_type="dataset",
                )
                print(f"https://huggingface.co/datasets/patrickvonplaten/papa/blob/main/{counter}.png")
                counter += 1