|
import gradio as gr |
|
from diffusers import StableDiffusionPipeline |
|
import torch |
|
|
|
|
|
model_id = "black-forest-labs/FLUX.1-dev" |
|
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16) |
|
pipe = pipe.to("cuda") |
|
|
|
|
|
pipe.unet.load_attn_procs("codermert/tugce2-lora") |
|
|
|
|
|
def generate_image(prompt): |
|
image = pipe(prompt).images[0] |
|
return image |
|
|
|
|
|
interface = gr.Interface( |
|
fn=generate_image, |
|
inputs=gr.Textbox(label="Prompt", placeholder="Enter your prompt here"), |
|
outputs=gr.Image(label="Generated Image") |
|
) |
|
|
|
|
|
if __name__ == "__main__": |
|
interface.launch() |
|
|