CoolFace
Apppublic

TSE1966/Super-Resolution-Anime-Diffusion

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
protogen.py54 linesDownload Raw Back to root
1# -*- coding: utf-8 -*-2# file: protogen.py3# time: 14:27 2023/1/94# author: yangheng <hy345@exeter.ac.uk>5# github: https://github.com/yangheng956# huggingface: https://huggingface.co/yangheng7# google scholar: https://scholar.google.com/citations?user=NPq5a_0AAAAJ&hl=en8# Copyright (C) 2021. All Rights Reserved.9 10from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler11import torch12import random13 14prompt_keys = [15    "naked",16    "loli",17    "teen",18    "squat",19    "big nipples",20    "hairy pussy",21    "pee",22    "beautiful eyes",23    # 'dress', 'wind', 'fingers', 'hands',24    # random.choice(['Sinon', 'saber', ]),25    # random.choice(['white dress', 'red dress', 'blonde dress', 'black dress', 'green dress', ]),26    # random.choice(['white bra', 'red bra', 'black bra',]),27    "lovely",28    "details",29    # random.choice(['white hair', 'red hair', 'blonde hair', 'black hair', 'green hair', ]),30    random.choice(["white hair"]),31    random.choice(["blue eyes", "red eyes", "black eyes"]),32    random.choice(["flower meadow", "garden"]),33]34prompt = ",".join(prompt_keys)35model_id = "darkstorm2150/Protogen_x3.4_Official_Release"36pipe = StableDiffusionPipeline.from_pretrained(37    model_id, torch_dtype=torch.float16, safety_checker=None38)39pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)40pipe = pipe.to("cuda")41 42guidance = 7.543width = 76844height = 51245image = pipe(46    prompt,47    num_inference_steps=25,48    guidance_scale=guidance,49    width=width,50    height=height,51).images[0]52 53image.save("./result.jpg")54