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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -25
app.py CHANGED
@@ -1,28 +1,12 @@
1
- import gradio as gr
2
- from diffusers import StableDiffusionPipeline
3
- import torch
4
 
5
- # Hugging Face'den FLUX modelini yükle
6
- model_id = "black-forest-labs/FLUX.1-dev"
7
- pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
8
- pipe = pipe.to("cuda") # GPU üzerinde çalışmak için CUDA'yı kullan
9
 
10
- # Kendi LoRA modelini FLUX ile birleştir
11
- pipe.unet.load_attn_procs("codermert/tugce2-lora")
12
 
13
- # Gradio için resim üretme fonksiyonu
14
- def generate_image(prompt):
15
- image = pipe(prompt).images[0]
16
- return image
17
-
18
- # Gradio arayüzü
19
- interface = gr.Interface(
20
- fn=generate_image,
21
- inputs=gr.Textbox(label="Prompt", placeholder="Enter your prompt here"),
22
- outputs=gr.Image(label="Generated Image")
23
- )
24
-
25
- # Uygulama başlatılır
26
- if __name__ == "__main__":
27
- interface.launch()
28
-
 
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")