Spaces:
Sleeping
Sleeping
File size: 780 Bytes
e74e40f |
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 |
# 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()
|