Spaces:
Running
on
Zero
Running
on
Zero
Bobby
commited on
Commit
·
db09a78
1
Parent(s):
b72d32f
local
Browse files- local_app.py +35 -31
local_app.py
CHANGED
@@ -33,7 +33,7 @@ preprocessor = Preprocessor()
|
|
33 |
preprocessor.load("NormalBae")
|
34 |
|
35 |
if gr.NO_RELOAD:
|
36 |
-
|
37 |
|
38 |
# Controlnet Normal
|
39 |
model_id = "lllyasviel/control_v11p_sd15_normalbae"
|
@@ -67,22 +67,22 @@ if gr.NO_RELOAD:
|
|
67 |
vae = AutoencoderKL.from_single_file(vae_url, torch_dtype=torch.float16).to("cuda")
|
68 |
vae.to(memory_format=torch.channels_last)
|
69 |
|
70 |
-
pipe = StableDiffusionControlNetPipeline.from_pretrained(
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
controlnet=controlnet,
|
74 |
scheduler=scheduler,
|
75 |
vae=vae,
|
76 |
torch_dtype=torch.float16,
|
77 |
).to("cuda")
|
78 |
-
|
79 |
-
# pipe = StableDiffusionControlNetPipeline.from_single_file(
|
80 |
-
# base_model_url,
|
81 |
-
# controlnet=controlnet,
|
82 |
-
# scheduler=scheduler,
|
83 |
-
# vae=vae,
|
84 |
-
# torch_dtype=torch.float16,
|
85 |
-
# )
|
86 |
|
87 |
pipe.load_textual_inversion("broyang/hentaidigitalart_v20", weight_name="EasyNegativeV2.safetensors", token="EasyNegativeV2",)
|
88 |
pipe.load_textual_inversion("broyang/hentaidigitalart_v20", weight_name="badhandv4.pt", token="badhandv4")
|
@@ -105,7 +105,7 @@ if gr.NO_RELOAD:
|
|
105 |
# @spaces.GPU(duration=12)
|
106 |
# pipe.enable_xformers_memory_efficient_attention()
|
107 |
# pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
108 |
-
|
109 |
torch.cuda.empty_cache()
|
110 |
gc.collect()
|
111 |
print("Model Compiled!")
|
@@ -162,61 +162,65 @@ style_list = [
|
|
162 |
},
|
163 |
{
|
164 |
"name": "Minimalistic",
|
165 |
-
"prompt": "
|
166 |
},
|
167 |
{
|
168 |
"name": "Boho Chic",
|
169 |
-
"prompt": "
|
170 |
},
|
171 |
{
|
172 |
"name": "Saudi Prince Gold",
|
173 |
-
"prompt": "
|
174 |
},
|
175 |
{
|
176 |
"name": "Modern Farmhouse",
|
177 |
-
"prompt": "
|
178 |
},
|
179 |
{
|
180 |
"name": "Neoclassical",
|
181 |
-
"prompt": "Neoclassical"
|
182 |
},
|
183 |
{
|
184 |
"name": "Eclectic",
|
185 |
-
"prompt": "Eclectic"
|
186 |
},
|
187 |
{
|
188 |
"name": "Parisian White",
|
189 |
-
"prompt": "Parisian
|
190 |
},
|
191 |
{
|
192 |
"name": "Hollywood Glam",
|
193 |
-
"prompt": "Hollywood
|
194 |
},
|
195 |
{
|
196 |
"name": "Scandinavian",
|
197 |
-
"prompt": "Scandinavian"
|
198 |
},
|
199 |
{
|
200 |
"name": "Japanese",
|
201 |
-
"prompt": "Japanese"
|
202 |
},
|
203 |
{
|
204 |
"name": "Texas Cowboy",
|
205 |
-
"prompt": "
|
206 |
},
|
207 |
{
|
208 |
"name": "Midcentury Modern",
|
209 |
-
"prompt": "
|
210 |
},
|
211 |
{
|
212 |
"name": "Beach",
|
213 |
-
"prompt": "
|
214 |
},
|
215 |
{
|
216 |
-
"name": "
|
217 |
"prompt": "Neon (atompunk world) retro cyberpunk background",
|
218 |
},
|
219 |
-
|
|
|
|
|
|
|
|
|
220 |
|
221 |
styles = {k["name"]: (k["prompt"]) for k in style_list}
|
222 |
STYLE_NAMES = list(styles.keys())
|
@@ -240,7 +244,7 @@ h3 {
|
|
240 |
text-align: center;
|
241 |
display:block;
|
242 |
}
|
243 |
-
.gradio-container{max-width:
|
244 |
footer {visibility: hidden}
|
245 |
"""
|
246 |
with gr.Blocks(theme="bethecloud/storj_theme", css=css) as demo:
|
@@ -282,8 +286,8 @@ with gr.Blocks(theme="bethecloud/storj_theme", css=css) as demo:
|
|
282 |
)
|
283 |
#############################################################################
|
284 |
# input text
|
285 |
-
with gr.Row():
|
286 |
-
|
287 |
with gr.Column():
|
288 |
prompt = gr.Textbox(
|
289 |
label="Custom Prompt",
|
|
|
33 |
preprocessor.load("NormalBae")
|
34 |
|
35 |
if gr.NO_RELOAD:
|
36 |
+
torch.cuda.max_memory_allocated(device="cuda")
|
37 |
|
38 |
# Controlnet Normal
|
39 |
model_id = "lllyasviel/control_v11p_sd15_normalbae"
|
|
|
67 |
vae = AutoencoderKL.from_single_file(vae_url, torch_dtype=torch.float16).to("cuda")
|
68 |
vae.to(memory_format=torch.channels_last)
|
69 |
|
70 |
+
# pipe = StableDiffusionControlNetPipeline.from_pretrained(
|
71 |
+
# base_model_id,
|
72 |
+
# safety_checker=None,
|
73 |
+
# controlnet=controlnet,
|
74 |
+
# scheduler=scheduler,
|
75 |
+
# vae=vae,
|
76 |
+
# torch_dtype=torch.float16,
|
77 |
+
# ).to("cuda")
|
78 |
+
|
79 |
+
pipe = StableDiffusionControlNetPipeline.from_single_file(
|
80 |
+
base_model_url,
|
81 |
controlnet=controlnet,
|
82 |
scheduler=scheduler,
|
83 |
vae=vae,
|
84 |
torch_dtype=torch.float16,
|
85 |
).to("cuda")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
pipe.load_textual_inversion("broyang/hentaidigitalart_v20", weight_name="EasyNegativeV2.safetensors", token="EasyNegativeV2",)
|
88 |
pipe.load_textual_inversion("broyang/hentaidigitalart_v20", weight_name="badhandv4.pt", token="badhandv4")
|
|
|
105 |
# @spaces.GPU(duration=12)
|
106 |
# pipe.enable_xformers_memory_efficient_attention()
|
107 |
# pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
|
108 |
+
pipe.unet.set_attn_processor(AttnProcessor2_0())
|
109 |
torch.cuda.empty_cache()
|
110 |
gc.collect()
|
111 |
print("Model Compiled!")
|
|
|
162 |
},
|
163 |
{
|
164 |
"name": "Minimalistic",
|
165 |
+
"prompt": "Minimalist interior design, clean lines, neutral colors, uncluttered space, functional furniture, lots of natural light"
|
166 |
},
|
167 |
{
|
168 |
"name": "Boho Chic",
|
169 |
+
"prompt": "Bohemian chic interior, eclectic mix of patterns and textures, vintage furniture, plants, woven textiles, warm earthy colors"
|
170 |
},
|
171 |
{
|
172 |
"name": "Saudi Prince Gold",
|
173 |
+
"prompt": "Opulent gold interior, luxurious ornate furniture, crystal chandeliers, rich fabrics, marble floors, intricate Arabic patterns"
|
174 |
},
|
175 |
{
|
176 |
"name": "Modern Farmhouse",
|
177 |
+
"prompt": "Modern farmhouse interior, rustic wood elements, shiplap walls, neutral color palette, industrial accents, cozy textiles"
|
178 |
},
|
179 |
{
|
180 |
"name": "Neoclassical",
|
181 |
+
"prompt": "Neoclassical interior design, elegant columns, ornate moldings, symmetrical layout, refined furniture, muted color palette"
|
182 |
},
|
183 |
{
|
184 |
"name": "Eclectic",
|
185 |
+
"prompt": "Eclectic interior design, mix of styles and eras, bold color combinations, diverse furniture pieces, unique art objects"
|
186 |
},
|
187 |
{
|
188 |
"name": "Parisian White",
|
189 |
+
"prompt": "Parisian apartment interior, all-white color scheme, ornate moldings, herringbone wood floors, elegant furniture, large windows"
|
190 |
},
|
191 |
{
|
192 |
"name": "Hollywood Glam",
|
193 |
+
"prompt": "Hollywood Regency interior, glamorous and luxurious, bold colors, mirrored surfaces, velvet upholstery, gold accents"
|
194 |
},
|
195 |
{
|
196 |
"name": "Scandinavian",
|
197 |
+
"prompt": "Scandinavian interior design, light wood tones, white walls, minimalist furniture, cozy textiles, hygge atmosphere"
|
198 |
},
|
199 |
{
|
200 |
"name": "Japanese",
|
201 |
+
"prompt": "Traditional Japanese interior, tatami mats, shoji screens, low furniture, zen garden view, minimalist decor, natural materials"
|
202 |
},
|
203 |
{
|
204 |
"name": "Texas Cowboy",
|
205 |
+
"prompt": "Western cowboy interior, rustic wood beams, leather furniture, cowhide rugs, antler chandeliers, southwestern patterns"
|
206 |
},
|
207 |
{
|
208 |
"name": "Midcentury Modern",
|
209 |
+
"prompt": "Mid-century modern interior, 1950s-60s style furniture, organic shapes, warm wood tones, bold accent colors, large windows"
|
210 |
},
|
211 |
{
|
212 |
"name": "Beach",
|
213 |
+
"prompt": "Coastal beach house interior, light blue and white color scheme, weathered wood, nautical accents, sheer curtains, ocean view"
|
214 |
},
|
215 |
{
|
216 |
+
"name": "Retro Futurism",
|
217 |
"prompt": "Neon (atompunk world) retro cyberpunk background",
|
218 |
},
|
219 |
+
{
|
220 |
+
"name": "The Matrix",
|
221 |
+
"prompt": "Futuristic cyberpunk interior, neon accent lighting, holographic plants, sleek black surfaces, advanced gaming setup, transparent screens, Blade Runner inspired decor, high-tech minimalist furniture, subtle Matrix green code effects, ceiling-to-floor digital displays, automated smart home features, hidden LED strips, metallic and glass materials, floating furniture pieces, ambient blue lighting"
|
222 |
+
}
|
223 |
+
]
|
224 |
|
225 |
styles = {k["name"]: (k["prompt"]) for k in style_list}
|
226 |
STYLE_NAMES = list(styles.keys())
|
|
|
244 |
text-align: center;
|
245 |
display:block;
|
246 |
}
|
247 |
+
.gradio-container{max-width: 1800px !important}
|
248 |
footer {visibility: hidden}
|
249 |
"""
|
250 |
with gr.Blocks(theme="bethecloud/storj_theme", css=css) as demo:
|
|
|
286 |
)
|
287 |
#############################################################################
|
288 |
# input text
|
289 |
+
# with gr.Row():
|
290 |
+
# gr.Text(label="Interior Design Style Examples", value="Eclectic, Maximalist, Bohemian, Scandinavian, Minimalist, Rustic, Modern Farmhouse, Contemporary, Luxury, Airbnb, Boho Chic, Midcentury Modern, Art Deco, Zen, Beach, Neoclassical, Industrial, Biophilic, Eco-friendly, Hollywood Glam, Parisian White, Saudi Prince Gold, French Country, Monster Energy Drink, Cyberpunk, Vaporwave, Baroque, etc.\n\nPro tip: add a color to customize it! You can also describe the furniture type.")
|
291 |
with gr.Column():
|
292 |
prompt = gr.Textbox(
|
293 |
label="Custom Prompt",
|