Spaces:
Runtime error
Runtime error
Update app2.py
Browse files
app2.py
CHANGED
|
@@ -31,6 +31,7 @@ import sys
|
|
| 31 |
sys.path.append("../")
|
| 32 |
from models.depth_normal_pipeline_clip import DepthNormalEstimationPipeline
|
| 33 |
#from models.depth_normal_pipeline_clip_cfg import DepthNormalEstimationPipeline
|
|
|
|
| 34 |
from utils.seed_all import seed_all
|
| 35 |
import matplotlib.pyplot as plt
|
| 36 |
from utils.de_normalized import align_scale_shift
|
|
@@ -54,8 +55,8 @@ sd_image_variations_diffusers_path = '.'
|
|
| 54 |
image_encoder = CLIPVisionModelWithProjection.from_pretrained(sd_image_variations_diffusers_path, subfolder="image_encoder")
|
| 55 |
feature_extractor = CLIPImageProcessor.from_pretrained(sd_image_variations_diffusers_path, subfolder="feature_extractor")
|
| 56 |
|
| 57 |
-
unet = UNet2DConditionModel.from_pretrained('./wocfg/unet_ema')
|
| 58 |
-
|
| 59 |
|
| 60 |
pipe = DepthNormalEstimationPipeline(vae=vae,
|
| 61 |
image_encoder=image_encoder,
|
|
@@ -77,7 +78,7 @@ def depth_normal(img,
|
|
| 77 |
denoising_steps,
|
| 78 |
ensemble_size,
|
| 79 |
processing_res,
|
| 80 |
-
|
| 81 |
domain):
|
| 82 |
|
| 83 |
#img = img.resize((processing_res, processing_res), Image.Resampling.LANCZOS)
|
|
@@ -87,7 +88,7 @@ def depth_normal(img,
|
|
| 87 |
ensemble_size=ensemble_size,
|
| 88 |
processing_res=processing_res,
|
| 89 |
batch_size=0,
|
| 90 |
-
|
| 91 |
domain=domain,
|
| 92 |
show_progress_bar=True,
|
| 93 |
)
|
|
@@ -151,13 +152,13 @@ def run_demo():
|
|
| 151 |
label="Data Type (Must Select One matches your image)",
|
| 152 |
value="indoor",
|
| 153 |
)
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
denoising_steps = gr.Slider(
|
| 162 |
label="Number of denoising steps (More stepes, better quality)",
|
| 163 |
minimum=1,
|
|
@@ -194,7 +195,7 @@ def run_demo():
|
|
| 194 |
inputs=[input_image, denoising_steps,
|
| 195 |
ensemble_size,
|
| 196 |
processing_res,
|
| 197 |
-
|
| 198 |
domain],
|
| 199 |
outputs=[depth, normal]
|
| 200 |
)
|
|
|
|
| 31 |
sys.path.append("../")
|
| 32 |
from models.depth_normal_pipeline_clip import DepthNormalEstimationPipeline
|
| 33 |
#from models.depth_normal_pipeline_clip_cfg import DepthNormalEstimationPipeline
|
| 34 |
+
from models.depth_normal_pipeline_clip_cfg1 import DepthNormalEstimationPipeline
|
| 35 |
from utils.seed_all import seed_all
|
| 36 |
import matplotlib.pyplot as plt
|
| 37 |
from utils.de_normalized import align_scale_shift
|
|
|
|
| 55 |
image_encoder = CLIPVisionModelWithProjection.from_pretrained(sd_image_variations_diffusers_path, subfolder="image_encoder")
|
| 56 |
feature_extractor = CLIPImageProcessor.from_pretrained(sd_image_variations_diffusers_path, subfolder="feature_extractor")
|
| 57 |
|
| 58 |
+
#unet = UNet2DConditionModel.from_pretrained('./wocfg/unet_ema')
|
| 59 |
+
unet = UNet2DConditionModel.from_pretrained('./cfg/unet_ema')
|
| 60 |
|
| 61 |
pipe = DepthNormalEstimationPipeline(vae=vae,
|
| 62 |
image_encoder=image_encoder,
|
|
|
|
| 78 |
denoising_steps,
|
| 79 |
ensemble_size,
|
| 80 |
processing_res,
|
| 81 |
+
guidance_scale,
|
| 82 |
domain):
|
| 83 |
|
| 84 |
#img = img.resize((processing_res, processing_res), Image.Resampling.LANCZOS)
|
|
|
|
| 88 |
ensemble_size=ensemble_size,
|
| 89 |
processing_res=processing_res,
|
| 90 |
batch_size=0,
|
| 91 |
+
guidance_scale=guidance_scale,
|
| 92 |
domain=domain,
|
| 93 |
show_progress_bar=True,
|
| 94 |
)
|
|
|
|
| 152 |
label="Data Type (Must Select One matches your image)",
|
| 153 |
value="indoor",
|
| 154 |
)
|
| 155 |
+
guidance_scale = gr.Slider(
|
| 156 |
+
label="Classifier Free Guidance Scale",
|
| 157 |
+
minimum=1,
|
| 158 |
+
maximum=5,
|
| 159 |
+
step=1,
|
| 160 |
+
value=1,
|
| 161 |
+
)
|
| 162 |
denoising_steps = gr.Slider(
|
| 163 |
label="Number of denoising steps (More stepes, better quality)",
|
| 164 |
minimum=1,
|
|
|
|
| 195 |
inputs=[input_image, denoising_steps,
|
| 196 |
ensemble_size,
|
| 197 |
processing_res,
|
| 198 |
+
guidance_scale,
|
| 199 |
domain],
|
| 200 |
outputs=[depth, normal]
|
| 201 |
)
|