codermert commited on
Commit
c9fd9e1
·
verified ·
1 Parent(s): bb5c631

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -9
app.py CHANGED
@@ -1,12 +1,23 @@
1
- from diffusers import DiffusionPipeline
 
2
 
3
- # FLUX modelini yükle
4
- pipeline = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev")
5
- pipeline.to("cuda")
6
 
7
- # Kendi LoRA modelini yükle
8
- pipeline.unet.load_attn_procs("codermert/tugce2-lora")
 
9
 
10
- # Prompt ile resim oluştur
11
- image = pipeline("A portrait of a woman smiling in a park").images[0]
12
- image.save("output.png")
 
 
 
 
 
 
 
 
 
 
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")