Update app.py
Browse files
app.py
CHANGED
|
@@ -1,28 +1,12 @@
|
|
| 1 |
-
|
| 2 |
-
from diffusers import StableDiffusionPipeline
|
| 3 |
-
import torch
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
pipe = pipe.to("cuda") # GPU üzerinde çalışmak için CUDA'yı kullan
|
| 9 |
|
| 10 |
-
# Kendi LoRA modelini
|
| 11 |
-
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
|
| 15 |
-
|
| 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")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|