File size: 521 Bytes
44ba841
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
from diffusers import StableDiffusionPipeline
import torch

# Load your LoRA fine-tuned model
model_id = "signupting/blak-lora"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe.to("cuda")  # Use GPU if available

# Function to generate images
def generate_image(prompt):
    image = pipe(prompt).images[0]
    return image

# Gradio Interface
demo = gr.Interface(fn=generate_image, inputs="text", outputs="image", title="Text-to-Image Generator")
demo.launch()