|
import gradio as gr |
|
import torch |
|
from diffusers import AutoPipelineForText2Image |
|
|
|
def generate_image(prompt): |
|
try: |
|
|
|
pipeline = AutoPipelineForText2Image.from_pretrained( |
|
'prithivMLmods/Canopus-LoRA-Flux-UltraRealism-2.0', |
|
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32 |
|
).to('cuda' if torch.cuda.is_available() else 'cpu') |
|
|
|
|
|
pipeline.load_lora_weights( |
|
'codermert/ezelll_flux', |
|
weight_name='flux_train_replicate.safetensors' |
|
) |
|
|
|
|
|
image = pipeline(prompt).images[0] |
|
return image |
|
except Exception as e: |
|
return str(e) |
|
|
|
|
|
with gr.Blocks() as iface: |
|
gr.Markdown("# Ezel Flux Görsel Oluşturucu") |
|
gr.Markdown("Bu model 'zehra' kelimesi ile en iyi sonucu verir.") |
|
|
|
with gr.Row(): |
|
text_input = gr.Textbox(label="Prompt'unuzu girin (zehra kelimesini kullanmayı unutmayın)") |
|
image_output = gr.Image(label="Oluşturulan Görsel") |
|
|
|
generate_btn = gr.Button("Görsel Oluştur") |
|
generate_btn.click(fn=generate_image, inputs=[text_input], outputs=[image_output]) |
|
|
|
|
|
iface.queue().launch(ssr_mode=False) |