File size: 809 Bytes
c3dc8bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import gradio as gr
from diffusers import StableDiffusionPipeline
import torch

# Hugging Face'den FLUX modelini yükle
model_id = "black-forest-labs/FLUX.1-dev"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe = pipe.to("cuda")  # GPU üzerinde çalışmak için CUDA'yı kullan

# Kendi LoRA modelini FLUX ile birleştir
pipe.unet.load_attn_procs("codermert/tugce2-lora")

# Gradio için resim üretme fonksiyonu
def generate_image(prompt):
    image = pipe(prompt).images[0]
    return image

# Gradio arayüzü
interface = gr.Interface(
    fn=generate_image,
    inputs=gr.Textbox(label="Prompt", placeholder="Enter your prompt here"),
    outputs=gr.Image(label="Generated Image")
)

# Uygulama başlatılır
if __name__ == "__main__":
    interface.launch()