Text-to-Image
Diffusers
Safetensors
1b / test.py
babkasotona's picture
Upload folder using huggingface_hub
7e72b1d verified
import torch
from diffusers import DiffusionPipeline
device = "cuda" if torch.cuda.is_available() else "cpu"
dtype = torch.float16 if torch.cuda.is_available() else torch.float32
pipe_id = "/root/sdxs-1b"
pipe = DiffusionPipeline.from_pretrained(
pipe_id,
torch_dtype=dtype,
trust_remote_code=True
).to(device)
prompt="There is a young male character standing against a vibrant, colorful graffiti wall. he is wearing a hat, a jacket adorned with gold accents, and black shorts."
#prompt = "A stylized digital detailed illustration of a melancholy female character with white hair and distinct pointed ears, seated cross-legged, wearing a sleeveless top featuring a bold red and black design on her thighs, paired with black thigh-high boots."
#prompt = "A young woman with striking blue eyes and pointed ears, with a dragon at background, adorned with a kimono and a tattoo. Her hair is styled in a braid, and she wears a pair of ears"
refined = pipe.refine_prompts(prompt)[0]
negative_prompt = "worst quality, low quality, photo, low details, blurry, jpeg artifacts, unfinished, sketch, sepia, missing limb, text, bad anatomy, bad proportions, bad hands, missing fingers"
print(refined)
output = pipe(
prompt=refined,
negative_prompt=negative_prompt,
#seed=43,
)
# Берем нулевую картинку и сам промпт (он будет строкой, так как мы подавали строку)
image = output.images[0]
refined_prompt_text = output.prompt
image.show()
image.save("media/girl1.jpg")
print(f"✨ refined_prompt_text:\n{refined_prompt_text}")