Spaces:
Running
on
Zero
Running
on
Zero
Alexander Bagus
commited on
Commit
·
2527cf0
1
Parent(s):
f13eb4d
22
Browse files
app.py
CHANGED
|
@@ -102,18 +102,18 @@ def inference(
|
|
| 102 |
|
| 103 |
# input_image, width, height = scale_image(input_image, image_scale)
|
| 104 |
# control_mode='HED'
|
| 105 |
-
|
| 106 |
if control_mode == 'HED':
|
| 107 |
-
|
| 108 |
if control_mode =='Midas':
|
| 109 |
-
|
| 110 |
if control_mode =='MLSD':
|
| 111 |
-
|
| 112 |
if control_mode =='Pose':
|
| 113 |
-
|
| 114 |
-
else:
|
| 115 |
-
processor = Processor('canny')
|
| 116 |
|
|
|
|
|
|
|
| 117 |
|
| 118 |
# Width must be divisible by 16
|
| 119 |
control_image, width, height = rescale_image(input_image, image_scale, 16)
|
|
@@ -122,7 +122,7 @@ def inference(
|
|
| 122 |
print("DEBUG: processor running")
|
| 123 |
control_image = processor(control_image, to_pil=True)
|
| 124 |
control_image = control_image.resize((width, height))
|
| 125 |
-
|
| 126 |
print("DEBUG: control_image_torch")
|
| 127 |
control_image_torch = get_image_latent(control_image, sample_size=[height, width])[:, :, 0]
|
| 128 |
|
|
|
|
| 102 |
|
| 103 |
# input_image, width, height = scale_image(input_image, image_scale)
|
| 104 |
# control_mode='HED'
|
| 105 |
+
processor_id = 'canny'
|
| 106 |
if control_mode == 'HED':
|
| 107 |
+
processor_id = 'softedge_hed'
|
| 108 |
if control_mode =='Midas':
|
| 109 |
+
processor_id = 'depth_midas'
|
| 110 |
if control_mode =='MLSD':
|
| 111 |
+
processor_id = 'mlsd'
|
| 112 |
if control_mode =='Pose':
|
| 113 |
+
processor_id = 'openpose_full'
|
|
|
|
|
|
|
| 114 |
|
| 115 |
+
print(f"DEBUG: processor_id={processor_id}")
|
| 116 |
+
processor = Processor(processor_id)
|
| 117 |
|
| 118 |
# Width must be divisible by 16
|
| 119 |
control_image, width, height = rescale_image(input_image, image_scale, 16)
|
|
|
|
| 122 |
print("DEBUG: processor running")
|
| 123 |
control_image = processor(control_image, to_pil=True)
|
| 124 |
control_image = control_image.resize((width, height))
|
| 125 |
+
|
| 126 |
print("DEBUG: control_image_torch")
|
| 127 |
control_image_torch = get_image_latent(control_image, sample_size=[height, width])[:, :, 0]
|
| 128 |
|