Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
import spaces
|
2 |
import random
|
3 |
import torch
|
4 |
import cv2
|
@@ -85,7 +85,7 @@ pipe_depth.load_ip_adapter(f'{ckpt_dir_ipa}' , subfolder="", weight_name=["ip_ad
|
|
85 |
pipe_canny.load_ip_adapter(f'{ckpt_dir_ipa}' , subfolder="", weight_name=["ip_adapter_plus_general.bin"])
|
86 |
pipe_pose.load_ip_adapter(f'{ckpt_dir_ipa}' , subfolder="", weight_name=["ip_adapter_plus_general.bin"])
|
87 |
|
88 |
-
|
89 |
def process_canny_condition(image, canny_threods=[100,200]):
|
90 |
np_image = image.copy()
|
91 |
np_image = cv2.Canny(np_image, canny_threods[0], canny_threods[1])
|
@@ -96,7 +96,7 @@ def process_canny_condition(image, canny_threods=[100,200]):
|
|
96 |
|
97 |
model_midas = MidasDetector()
|
98 |
|
99 |
-
|
100 |
def process_depth_condition_midas(img, res = 1024):
|
101 |
h,w,_ = img.shape
|
102 |
img = resize_image(HWC3(img), res)
|
@@ -105,7 +105,7 @@ def process_depth_condition_midas(img, res = 1024):
|
|
105 |
return Image.fromarray(result)
|
106 |
|
107 |
model_dwpose = DWposeDetector()
|
108 |
-
|
109 |
def process_dwpose_condition(image, res=1024):
|
110 |
h,w,_ = image.shape
|
111 |
img = resize_image(HWC3(image), res)
|
@@ -117,7 +117,7 @@ def process_dwpose_condition(image, res=1024):
|
|
117 |
MAX_SEED = np.iinfo(np.int32).max
|
118 |
MAX_IMAGE_SIZE = 1024
|
119 |
|
120 |
-
|
121 |
def infer_depth(prompt,
|
122 |
image = None,
|
123 |
ipa_img = None,
|
@@ -154,7 +154,7 @@ def infer_depth(prompt,
|
|
154 |
).images[0]
|
155 |
return [condi_img, image], seed
|
156 |
|
157 |
-
|
158 |
def infer_canny(prompt,
|
159 |
image = None,
|
160 |
ipa_img = None,
|
@@ -191,7 +191,7 @@ def infer_canny(prompt,
|
|
191 |
).images[0]
|
192 |
return [condi_img, image], seed
|
193 |
|
194 |
-
|
195 |
def infer_pose(prompt,
|
196 |
image = None,
|
197 |
ipa_img = None,
|
@@ -388,4 +388,4 @@ with gr.Blocks(css=css) as Kolors:
|
|
388 |
outputs = [result, seed_used]
|
389 |
)
|
390 |
|
391 |
-
Kolors.queue().launch(debug=True)
|
|
|
1 |
+
#import spaces
|
2 |
import random
|
3 |
import torch
|
4 |
import cv2
|
|
|
85 |
pipe_canny.load_ip_adapter(f'{ckpt_dir_ipa}' , subfolder="", weight_name=["ip_adapter_plus_general.bin"])
|
86 |
pipe_pose.load_ip_adapter(f'{ckpt_dir_ipa}' , subfolder="", weight_name=["ip_adapter_plus_general.bin"])
|
87 |
|
88 |
+
#@spaces.GPU
|
89 |
def process_canny_condition(image, canny_threods=[100,200]):
|
90 |
np_image = image.copy()
|
91 |
np_image = cv2.Canny(np_image, canny_threods[0], canny_threods[1])
|
|
|
96 |
|
97 |
model_midas = MidasDetector()
|
98 |
|
99 |
+
#@spaces.GPU
|
100 |
def process_depth_condition_midas(img, res = 1024):
|
101 |
h,w,_ = img.shape
|
102 |
img = resize_image(HWC3(img), res)
|
|
|
105 |
return Image.fromarray(result)
|
106 |
|
107 |
model_dwpose = DWposeDetector()
|
108 |
+
#@spaces.GPU
|
109 |
def process_dwpose_condition(image, res=1024):
|
110 |
h,w,_ = image.shape
|
111 |
img = resize_image(HWC3(image), res)
|
|
|
117 |
MAX_SEED = np.iinfo(np.int32).max
|
118 |
MAX_IMAGE_SIZE = 1024
|
119 |
|
120 |
+
#@spaces.GPU
|
121 |
def infer_depth(prompt,
|
122 |
image = None,
|
123 |
ipa_img = None,
|
|
|
154 |
).images[0]
|
155 |
return [condi_img, image], seed
|
156 |
|
157 |
+
#@spaces.GPU
|
158 |
def infer_canny(prompt,
|
159 |
image = None,
|
160 |
ipa_img = None,
|
|
|
191 |
).images[0]
|
192 |
return [condi_img, image], seed
|
193 |
|
194 |
+
#@spaces.GPU
|
195 |
def infer_pose(prompt,
|
196 |
image = None,
|
197 |
ipa_img = None,
|
|
|
388 |
outputs = [result, seed_used]
|
389 |
)
|
390 |
|
391 |
+
Kolors.queue().launch(debug=True, share = True)
|