Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ from PIL import Image
|
|
10 |
from diffusers import QwenImageControlNetPipeline, QwenImageControlNetModel
|
11 |
|
12 |
# --- Preprocessor Imports ---
|
13 |
-
from controlnet_aux import OpenposeDetector
|
14 |
from depth_anything_v2.dpt import DepthAnythingV2
|
15 |
|
16 |
# --- Prompt Enhancement Imports ---
|
@@ -98,7 +98,7 @@ depth_anything = depth_anything.to(device).eval()
|
|
98 |
# Load Pose and Soft Edge Detectors
|
99 |
print("Loading other detectors...")
|
100 |
openpose_detector = OpenposeDetector.from_pretrained("lllyasviel/Annotators")
|
101 |
-
anyline_detector = AnylineDetector.from_pretrained("lllyasviel/Annotators", filename="anyline.pth").to(device)
|
102 |
|
103 |
print("All models loaded.")
|
104 |
|
@@ -106,8 +106,8 @@ def get_control_image(input_image, control_mode):
|
|
106 |
"""A master function to select and run the correct preprocessor."""
|
107 |
if control_mode == "Canny":
|
108 |
return extract_canny(input_image)
|
109 |
-
elif control_mode == "Soft Edge":
|
110 |
-
|
111 |
elif control_mode == "Depth":
|
112 |
image_np = np.array(input_image)
|
113 |
with torch.no_grad():
|
|
|
10 |
from diffusers import QwenImageControlNetPipeline, QwenImageControlNetModel
|
11 |
|
12 |
# --- Preprocessor Imports ---
|
13 |
+
from controlnet_aux import OpenposeDetector #, AnylineDetector
|
14 |
from depth_anything_v2.dpt import DepthAnythingV2
|
15 |
|
16 |
# --- Prompt Enhancement Imports ---
|
|
|
98 |
# Load Pose and Soft Edge Detectors
|
99 |
print("Loading other detectors...")
|
100 |
openpose_detector = OpenposeDetector.from_pretrained("lllyasviel/Annotators")
|
101 |
+
#anyline_detector = AnylineDetector.from_pretrained("lllyasviel/Annotators", filename="anyline.pth").to(device)
|
102 |
|
103 |
print("All models loaded.")
|
104 |
|
|
|
106 |
"""A master function to select and run the correct preprocessor."""
|
107 |
if control_mode == "Canny":
|
108 |
return extract_canny(input_image)
|
109 |
+
#elif control_mode == "Soft Edge":
|
110 |
+
# return anyline_detector(input_image, to_pil=True)
|
111 |
elif control_mode == "Depth":
|
112 |
image_np = np.array(input_image)
|
113 |
with torch.no_grad():
|