ma4389's picture
Upload 2 files
e74e40f verified
raw
history blame
780 Bytes
# gradio_app.py
import torch
from diffusers import DiffusionPipeline
import gradio as gr
# Load model
pipe = DiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", torch_dtype=torch.float16)
pipe.to("cuda")
pipe.load_lora_weights("EliKet/train_text_to_img")
# Generation function
def generate_image(prompt):
image = pipe(prompt).images[0]
return image
# Gradio Interface
demo = gr.Interface(
fn=generate_image,
inputs=gr.Textbox(lines=2, placeholder="Enter your image prompt here..."),
outputs="image",
title="๐Ÿพ Lynx Text-to-Image Generator",
description="Type a prompt (e.g., 'A majestic lynx in a snowy forest') and get an AI-generated image using Stable Diffusion + LoRA."
)
# Launch app
demo.launch()