mannchauhan commited on
Commit
cffcf27
·
verified ·
1 Parent(s): 1b5741f

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +29 -0
  2. requirements.txt +6 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import torch
3
+ from diffusers import StableDiffusionXLPipeline
4
+
5
+ model_id = "stabilityai/stable-diffusion-xl-base-1.0"
6
+
7
+ pipe = StableDiffusionXLPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
8
+ pipe = pipe.to("cuda" if torch.cuda.is_available() else "cpu")
9
+
10
+ def generate(prompt):
11
+ image = pipe(prompt).images[0]
12
+ return image
13
+
14
+ title = "🛋️ Virtual Room Decorator"
15
+ description = "Generate stunning room decor with AI using SDXL. Describe your room style, and get instant visuals."
16
+
17
+ gr.Interface(
18
+ fn=generate,
19
+ inputs=gr.Textbox(lines=2, placeholder="e.g. a cozy living room with wooden floors and indoor plants"),
20
+ outputs=gr.Image(type="pil"),
21
+ title=title,
22
+ description=description,
23
+ theme="soft",
24
+ examples=[
25
+ ["A minimalist bedroom with a large window and warm lighting"],
26
+ ["A futuristic workspace with sleek furniture and LED lights"],
27
+ ["A kid's room with toys, a bunk bed, and cartoon wall art"]
28
+ ]
29
+ ).launch()
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ diffusers==0.34.0
2
+ transformers
3
+ torch
4
+ gradio
5
+ accelerate
6
+ safetensors