TugceL / app.py
codermert's picture
Update app.py
c9fd9e1 verified
raw
history blame
723 Bytes
from diffusers import DiffusionPipeline, StableDiffusionPipeline
import torch
# Model ve LoRA'yı yükle
model_id = "black-forest-labs/FLUX.1-dev"
lora_model_path = "codermert/tugce2-lora"
# Pipeline'ı oluştur
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe.to("cuda")
# LoRA'yı yükle
pipe.unet.load_attn_procs(lora_model_path)
# Prompt oluştur
prompt = "A portrait of a woman with brown hair, smiling, high quality, detailed"
negative_prompt = "blurry, low quality, distorted"
# Görüntü oluştur
image = pipe(prompt=prompt, negative_prompt=negative_prompt, num_inference_steps=30, guidance_scale=7.5).images[0]
# Görüntüyü kaydet
image.save("generated_image.png")