Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,23 @@
|
|
| 1 |
-
from diffusers import DiffusionPipeline
|
|
|
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
|
| 5 |
-
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
|
|
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from diffusers import DiffusionPipeline, StableDiffusionPipeline
|
| 2 |
+
import torch
|
| 3 |
|
| 4 |
+
# Model ve LoRA'yı yükle
|
| 5 |
+
model_id = "black-forest-labs/FLUX.1-dev"
|
| 6 |
+
lora_model_path = "codermert/tugce2-lora"
|
| 7 |
|
| 8 |
+
# Pipeline'ı oluştur
|
| 9 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
| 10 |
+
pipe.to("cuda")
|
| 11 |
|
| 12 |
+
# LoRA'yı yükle
|
| 13 |
+
pipe.unet.load_attn_procs(lora_model_path)
|
| 14 |
+
|
| 15 |
+
# Prompt oluştur
|
| 16 |
+
prompt = "A portrait of a woman with brown hair, smiling, high quality, detailed"
|
| 17 |
+
negative_prompt = "blurry, low quality, distorted"
|
| 18 |
+
|
| 19 |
+
# Görüntü oluştur
|
| 20 |
+
image = pipe(prompt=prompt, negative_prompt=negative_prompt, num_inference_steps=30, guidance_scale=7.5).images[0]
|
| 21 |
+
|
| 22 |
+
# Görüntüyü kaydet
|
| 23 |
+
image.save("generated_image.png")
|