Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -33,6 +33,41 @@ css = """
|
|
33 |
}
|
34 |
"""
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
def filter_items(
|
38 |
colors_list: Union[List, np.ndarray],
|
@@ -387,41 +422,6 @@ def create_demo(model):
|
|
387 |
inputs=[input_image, input_text], cache_examples=False)
|
388 |
|
389 |
|
390 |
-
controlnet_depth= ControlNetModel.from_pretrained(
|
391 |
-
"controlnet_depth", torch_dtype=dtype, use_safetensors=True)
|
392 |
-
controlnet_seg = ControlNetModel.from_pretrained(
|
393 |
-
"own_controlnet", torch_dtype=dtype, use_safetensors=True)
|
394 |
-
|
395 |
-
pipe = StableDiffusionControlNetInpaintPipeline.from_pretrained(
|
396 |
-
"SG161222/Realistic_Vision_V5.1_noVAE",
|
397 |
-
#"models/runwayml--stable-diffusion-inpainting",
|
398 |
-
controlnet=[controlnet_depth, controlnet_seg],
|
399 |
-
safety_checker=None,
|
400 |
-
torch_dtype=dtype
|
401 |
-
)
|
402 |
-
|
403 |
-
pipe.load_ip_adapter("h94/IP-Adapter", subfolder="models",
|
404 |
-
weight_name="ip-adapter_sd15.bin")
|
405 |
-
pipe.set_ip_adapter_scale(0.4)
|
406 |
-
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|
407 |
-
pipe = pipe.to(device)
|
408 |
-
guide_pipe = StableDiffusionXLPipeline.from_pretrained("segmind/SSD-1B",
|
409 |
-
torch_dtype=dtype, use_safetensors=True, variant="fp16")
|
410 |
-
guide_pipe = guide_pipe.to(device)
|
411 |
-
|
412 |
-
seg_image_processor, image_segmentor = get_segmentation_pipeline()
|
413 |
-
depth_feature_extractor, depth_estimator = get_depth_pipeline()
|
414 |
-
depth_estimator = depth_estimator.to(device)
|
415 |
-
|
416 |
-
# ---------------------------------------
|
417 |
-
# Load Detr Model
|
418 |
-
# ---------------------------------------
|
419 |
-
detr_model = DetrForObjectDetection.from_pretrained("facebook-detr-50",
|
420 |
-
# id2label={v:k for k,v in CLASS2ID.items()},
|
421 |
-
use_safetensors=True)
|
422 |
-
detr_processor = DetrImageProcessor.from_pretrained("facebook-detr-50",
|
423 |
-
use_safetensors=True)
|
424 |
-
|
425 |
def main():
|
426 |
model = ControlNetDepthDesignModelMulti()
|
427 |
print('Models uploaded successfully')
|
|
|
33 |
}
|
34 |
"""
|
35 |
|
36 |
+
controlnet_depth= ControlNetModel.from_pretrained(
|
37 |
+
"controlnet_depth", torch_dtype=dtype, use_safetensors=True)
|
38 |
+
controlnet_seg = ControlNetModel.from_pretrained(
|
39 |
+
"own_controlnet", torch_dtype=dtype, use_safetensors=True)
|
40 |
+
|
41 |
+
pipe = StableDiffusionControlNetInpaintPipeline.from_pretrained(
|
42 |
+
"SG161222/Realistic_Vision_V5.1_noVAE",
|
43 |
+
#"models/runwayml--stable-diffusion-inpainting",
|
44 |
+
controlnet=[controlnet_depth, controlnet_seg],
|
45 |
+
safety_checker=None,
|
46 |
+
torch_dtype=dtype
|
47 |
+
)
|
48 |
+
|
49 |
+
pipe.load_ip_adapter("h94/IP-Adapter", subfolder="models",
|
50 |
+
weight_name="ip-adapter_sd15.bin")
|
51 |
+
pipe.set_ip_adapter_scale(0.4)
|
52 |
+
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|
53 |
+
pipe = pipe.to(device)
|
54 |
+
guide_pipe = StableDiffusionXLPipeline.from_pretrained("segmind/SSD-1B",
|
55 |
+
torch_dtype=dtype, use_safetensors=True, variant="fp16")
|
56 |
+
guide_pipe = guide_pipe.to(device)
|
57 |
+
|
58 |
+
seg_image_processor, image_segmentor = get_segmentation_pipeline()
|
59 |
+
depth_feature_extractor, depth_estimator = get_depth_pipeline()
|
60 |
+
depth_estimator = depth_estimator.to(device)
|
61 |
+
|
62 |
+
# ---------------------------------------
|
63 |
+
# Load Detr Model
|
64 |
+
# ---------------------------------------
|
65 |
+
detr_model = DetrForObjectDetection.from_pretrained("facebook-detr-50",
|
66 |
+
# id2label={v:k for k,v in CLASS2ID.items()},
|
67 |
+
use_safetensors=True)
|
68 |
+
detr_processor = DetrImageProcessor.from_pretrained("facebook-detr-50",
|
69 |
+
use_safetensors=True)
|
70 |
+
|
71 |
|
72 |
def filter_items(
|
73 |
colors_list: Union[List, np.ndarray],
|
|
|
422 |
inputs=[input_image, input_text], cache_examples=False)
|
423 |
|
424 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
def main():
|
426 |
model = ControlNetDepthDesignModelMulti()
|
427 |
print('Models uploaded successfully')
|