nick_93 commited on
Commit
3b49dff
1 Parent(s): f493b13
Files changed (1) hide show
  1. app.py +28 -29
app.py CHANGED
@@ -18,34 +18,6 @@ import gc
18
  device = "cuda"
19
  dtype = torch.float16
20
 
21
-
22
- controlnet_depth= ControlNetModel.from_pretrained(
23
- "controlnet_depth", torch_dtype=dtype, use_safetensors=True)
24
- controlnet_seg = ControlNetModel.from_pretrained(
25
- "own_controlnet", torch_dtype=dtype, use_safetensors=True)
26
-
27
- pipe = StableDiffusionControlNetInpaintPipeline.from_pretrained(
28
- "SG161222/Realistic_Vision_V5.1_noVAE",
29
- #"models/runwayml--stable-diffusion-inpainting",
30
- controlnet=[controlnet_depth, controlnet_seg],
31
- safety_checker=None,
32
- torch_dtype=dtype
33
- )
34
-
35
- pipe.load_ip_adapter("h94/IP-Adapter", subfolder="models",
36
- weight_name="ip-adapter_sd15.bin")
37
- pipe.set_ip_adapter_scale(0.4)
38
- pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
39
- pipe = pipe.to(device)
40
- guide_pipe = StableDiffusionXLPipeline.from_pretrained("segmind/SSD-1B",
41
- torch_dtype=dtype, use_safetensors=True, variant="fp16")
42
- guide_pipe = guide_pipe.to(device)
43
-
44
- seg_image_processor, image_segmentor = get_segmentation_pipeline()
45
- depth_feature_extractor, depth_estimator = get_depth_pipeline()
46
- depth_estimator = depth_estimator.to(device)
47
-
48
-
49
 
50
  css = """
51
  #img-display-container {
@@ -353,7 +325,34 @@ def create_demo(model):
353
  examples = gr.Examples(examples=[["imgs/bedroom_1.jpg", "An elegantly appointed bedroom in the Art Deco style, featuring a grand king-size bed with geometric bedding, a luxurious velvet armchair, and a mirrored nightstand that reflects the room's opulence. Art Deco-inspired artwork adds a touch of glamour"], ["imgs/bedroom_2.jpg", "A bedroom that exudes French country charm with a soft upholstered bed, walls adorned with floral wallpaper, and a vintage wooden wardrobe. A crystal chandelier casts a warm, inviting glow over the space"], ["imgs/dinning_room_1.jpg", "A cozy dining room that captures the essence of rustic charm with a solid wooden farmhouse table at its core, surrounded by an eclectic mix of mismatched chairs. An antique sideboard serves as a statement piece, and the ambiance is warmly lit by a series of quaint Edison bulbs dangling from the ceiling"], ["imgs/dinning_room_3.jpg", "A dining room that epitomizes contemporary elegance, anchored by a sleek, minimalist dining table paired with stylish modern chairs. Artistic lighting fixtures create a focal point above, while the surrounding minimalist decor ensures the space feels open, airy, and utterly modern"], ["imgs/image_1.jpg", "A glamorous master bedroom in Hollywood Regency style, boasting a plush tufted headboard, mirrored furniture reflecting elegance, luxurious fabrics in rich textures, and opulent gold accents for a touch of luxury."], ["imgs/image_2.jpg", "A vibrant living room with a tropical theme, complete with comfortable rattan furniture, large leafy plants bringing the outdoors in, bright cushions adding pops of color, and bamboo blinds for natural light control."], ["imgs/living_room_1.jpg", "A stylish living room embracing mid-century modern aesthetics, featuring a vintage teak coffee table at its center, complemented by a classic sunburst clock on the wall and a cozy shag rug underfoot, creating a warm and inviting atmosphere"]],
354
  inputs=[input_image, input_text])
355
 
356
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  def main():
358
  model = ControlNetDepthDesignModelMulti()
359
  print('Models uploaded successfully')
 
18
  device = "cuda"
19
  dtype = torch.float16
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  css = """
23
  #img-display-container {
 
325
  examples = gr.Examples(examples=[["imgs/bedroom_1.jpg", "An elegantly appointed bedroom in the Art Deco style, featuring a grand king-size bed with geometric bedding, a luxurious velvet armchair, and a mirrored nightstand that reflects the room's opulence. Art Deco-inspired artwork adds a touch of glamour"], ["imgs/bedroom_2.jpg", "A bedroom that exudes French country charm with a soft upholstered bed, walls adorned with floral wallpaper, and a vintage wooden wardrobe. A crystal chandelier casts a warm, inviting glow over the space"], ["imgs/dinning_room_1.jpg", "A cozy dining room that captures the essence of rustic charm with a solid wooden farmhouse table at its core, surrounded by an eclectic mix of mismatched chairs. An antique sideboard serves as a statement piece, and the ambiance is warmly lit by a series of quaint Edison bulbs dangling from the ceiling"], ["imgs/dinning_room_3.jpg", "A dining room that epitomizes contemporary elegance, anchored by a sleek, minimalist dining table paired with stylish modern chairs. Artistic lighting fixtures create a focal point above, while the surrounding minimalist decor ensures the space feels open, airy, and utterly modern"], ["imgs/image_1.jpg", "A glamorous master bedroom in Hollywood Regency style, boasting a plush tufted headboard, mirrored furniture reflecting elegance, luxurious fabrics in rich textures, and opulent gold accents for a touch of luxury."], ["imgs/image_2.jpg", "A vibrant living room with a tropical theme, complete with comfortable rattan furniture, large leafy plants bringing the outdoors in, bright cushions adding pops of color, and bamboo blinds for natural light control."], ["imgs/living_room_1.jpg", "A stylish living room embracing mid-century modern aesthetics, featuring a vintage teak coffee table at its center, complemented by a classic sunburst clock on the wall and a cozy shag rug underfoot, creating a warm and inviting atmosphere"]],
326
  inputs=[input_image, input_text])
327
 
328
+
329
+ controlnet_depth= ControlNetModel.from_pretrained(
330
+ "controlnet_depth", torch_dtype=dtype, use_safetensors=True)
331
+ controlnet_seg = ControlNetModel.from_pretrained(
332
+ "own_controlnet", torch_dtype=dtype, use_safetensors=True)
333
+
334
+ pipe = StableDiffusionControlNetInpaintPipeline.from_pretrained(
335
+ "SG161222/Realistic_Vision_V5.1_noVAE",
336
+ #"models/runwayml--stable-diffusion-inpainting",
337
+ controlnet=[controlnet_depth, controlnet_seg],
338
+ safety_checker=None,
339
+ torch_dtype=dtype
340
+ )
341
+
342
+ pipe.load_ip_adapter("h94/IP-Adapter", subfolder="models",
343
+ weight_name="ip-adapter_sd15.bin")
344
+ pipe.set_ip_adapter_scale(0.4)
345
+ pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
346
+ pipe = pipe.to(device)
347
+ guide_pipe = StableDiffusionXLPipeline.from_pretrained("segmind/SSD-1B",
348
+ torch_dtype=dtype, use_safetensors=True, variant="fp16")
349
+ guide_pipe = guide_pipe.to(device)
350
+
351
+ seg_image_processor, image_segmentor = get_segmentation_pipeline()
352
+ depth_feature_extractor, depth_estimator = get_depth_pipeline()
353
+ depth_estimator = depth_estimator.to(device)
354
+
355
+
356
  def main():
357
  model = ControlNetDepthDesignModelMulti()
358
  print('Models uploaded successfully')