Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -33,42 +33,6 @@ css = """
|
|
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],
|
74 |
items_list: Union[List, np.ndarray],
|
@@ -422,6 +386,41 @@ def create_demo(model):
|
|
422 |
inputs=[input_image, input_text], cache_examples=False)
|
423 |
|
424 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
def main():
|
426 |
model = ControlNetDepthDesignModelMulti()
|
427 |
print('Models uploaded successfully')
|
@@ -438,7 +437,7 @@ def main():
|
|
438 |
gr.HTML('''<br><br><br><center>You can duplicate this Space to skip the queue:<a href="https://huggingface.co/spaces/MykolaL/StableDesign?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a><br>
|
439 |
<p><img src="https://visitor-badge.glitch.me/badge?page_id=MykolaL/StableDesign" alt="visitors"></p></center>''')
|
440 |
|
441 |
-
demo.queue().launch(share=False
|
442 |
|
443 |
|
444 |
if __name__ == '__main__':
|
|
|
33 |
}
|
34 |
"""
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
def filter_items(
|
37 |
colors_list: Union[List, np.ndarray],
|
38 |
items_list: Union[List, np.ndarray],
|
|
|
386 |
inputs=[input_image, input_text], cache_examples=False)
|
387 |
|
388 |
|
389 |
+
controlnet_depth= ControlNetModel.from_pretrained(
|
390 |
+
"controlnet_depth", torch_dtype=dtype, use_safetensors=True)
|
391 |
+
controlnet_seg = ControlNetModel.from_pretrained(
|
392 |
+
"own_controlnet", torch_dtype=dtype, use_safetensors=True)
|
393 |
+
|
394 |
+
pipe = StableDiffusionControlNetInpaintPipeline.from_pretrained(
|
395 |
+
"SG161222/Realistic_Vision_V5.1_noVAE",
|
396 |
+
#"models/runwayml--stable-diffusion-inpainting",
|
397 |
+
controlnet=[controlnet_depth, controlnet_seg],
|
398 |
+
safety_checker=None,
|
399 |
+
torch_dtype=dtype
|
400 |
+
)
|
401 |
+
|
402 |
+
pipe.load_ip_adapter("h94/IP-Adapter", subfolder="models",
|
403 |
+
weight_name="ip-adapter_sd15.bin")
|
404 |
+
pipe.set_ip_adapter_scale(0.4)
|
405 |
+
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|
406 |
+
pipe = pipe.to(device)
|
407 |
+
guide_pipe = StableDiffusionXLPipeline.from_pretrained("segmind/SSD-1B",
|
408 |
+
torch_dtype=dtype, use_safetensors=True, variant="fp16")
|
409 |
+
guide_pipe = guide_pipe.to(device)
|
410 |
+
|
411 |
+
seg_image_processor, image_segmentor = get_segmentation_pipeline()
|
412 |
+
depth_feature_extractor, depth_estimator = get_depth_pipeline()
|
413 |
+
depth_estimator = depth_estimator.to(device)
|
414 |
+
|
415 |
+
# ---------------------------------------
|
416 |
+
# Load Detr Model
|
417 |
+
# ---------------------------------------
|
418 |
+
detr_model = DetrForObjectDetection.from_pretrained("facebook-detr-50",
|
419 |
+
# id2label={v:k for k,v in CLASS2ID.items()},
|
420 |
+
use_safetensors=True)
|
421 |
+
detr_processor = DetrImageProcessor.from_pretrained("facebook-detr-50",
|
422 |
+
use_safetensors=True)
|
423 |
+
|
424 |
def main():
|
425 |
model = ControlNetDepthDesignModelMulti()
|
426 |
print('Models uploaded successfully')
|
|
|
437 |
gr.HTML('''<br><br><br><center>You can duplicate this Space to skip the queue:<a href="https://huggingface.co/spaces/MykolaL/StableDesign?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a><br>
|
438 |
<p><img src="https://visitor-badge.glitch.me/badge?page_id=MykolaL/StableDesign" alt="visitors"></p></center>''')
|
439 |
|
440 |
+
demo.queue().launch(share=False)
|
441 |
|
442 |
|
443 |
if __name__ == '__main__':
|