mannchauhan's picture
Upload 2 files
e16dd0e verified
raw
history blame contribute delete
734 Bytes
import gradio as gr
import torch
from diffusers import StableDiffusionXLPipeline
pipe = StableDiffusionXLPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0",
torch_dtype=torch.float16,
use_safetensors=True
)
pipe.to("cuda" if torch.cuda.is_available() else "cpu")
def generate_image(prompt):
image = pipe(prompt).images[0]
return image
gr.Interface(
fn=generate_image,
inputs=gr.Textbox(label="prompt", placeholder="e.g., A modern room with blue walls, white sofa, and window"),
outputs="image",
title="🛋️ Virtual Room Decorator - SDXL",
description="Type how you want the room to look. Example: 'A cozy room with grey walls, plants, and wooden furniture.'"
).launch()