Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import torch | |
| from diffusers import StableDiffusionXLPipeline | |
| model_id = "stabilityai/stable-diffusion-xl-base-1.0" | |
| pipe = StableDiffusionXLPipeline.from_pretrained(model_id, torch_dtype=torch.float16) | |
| pipe = pipe.to("cuda" if torch.cuda.is_available() else "cpu") | |
| def generate(prompt): | |
| image = pipe(prompt).images[0] | |
| return image | |
| title = "🛋️ Virtual Room Decorator" | |
| description = "Generate stunning room decor with AI using SDXL. Describe your room style, and get instant visuals." | |
| gr.Interface( | |
| fn=generate, | |
| inputs=gr.Textbox(lines=2, placeholder="e.g. a cozy living room with wooden floors and indoor plants"), | |
| outputs=gr.Image(type="pil"), | |
| title=title, | |
| description=description, | |
| theme="soft", | |
| examples=[ | |
| ["A minimalist bedroom with a large window and warm lighting"], | |
| ["A futuristic workspace with sleek furniture and LED lights"], | |
| ["A kid's room with toys, a bunk bed, and cartoon wall art"] | |
| ] | |
| ).launch() | |