Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -19,15 +19,17 @@ from models.pipeline_mimicbrush import MimicBrushPipeline
|
|
19 |
from models.ReferenceNet import ReferenceNet
|
20 |
from models.depth_guider import DepthGuider
|
21 |
from mimicbrush import MimicBrush_RefNet
|
22 |
-
from data_utils import *
|
23 |
from modelscope.hub.snapshot_download import snapshot_download as ms_snapshot_download
|
24 |
import spaces
|
25 |
|
26 |
|
|
|
27 |
sd_dir = ms_snapshot_download('xichen/cleansd', cache_dir='./modelscope')
|
28 |
print('=== Pretrained SD weights downloaded ===')
|
29 |
model_dir = ms_snapshot_download('xichen/MimicBrush', cache_dir='./modelscope')
|
30 |
print('=== MimicBrush weights downloaded ===')
|
|
|
31 |
val_configs = OmegaConf.load('./configs/inference.yaml')
|
32 |
|
33 |
# === import Depth Anything ===
|
@@ -175,7 +177,6 @@ referencenet = ReferenceNet.from_pretrained(ref_model_path, subfolder="unet").to
|
|
175 |
mimicbrush_model = MimicBrush_RefNet(pipe, image_encoder_path, mimicbrush_ckpt, depth_anything_model, depth_guider, referencenet, device)
|
176 |
mask_processor = VaeImageProcessor(vae_scale_factor=1, do_normalize=False, do_binarize=True, do_convert_grayscale=True)
|
177 |
|
178 |
-
|
179 |
@spaces.GPU
|
180 |
def infer_single(ref_image, target_image, target_mask, seed = -1, num_inference_steps=50, guidance_scale = 5, enable_shape_control = False):
|
181 |
#return ref_image
|
@@ -364,4 +365,4 @@ with gr.Blocks() as demo:
|
|
364 |
outputs=[baseline_gallery]
|
365 |
)
|
366 |
|
367 |
-
demo.launch()
|
|
|
19 |
from models.ReferenceNet import ReferenceNet
|
20 |
from models.depth_guider import DepthGuider
|
21 |
from mimicbrush import MimicBrush_RefNet
|
22 |
+
from dataset.data_utils import *
|
23 |
from modelscope.hub.snapshot_download import snapshot_download as ms_snapshot_download
|
24 |
import spaces
|
25 |
|
26 |
|
27 |
+
|
28 |
sd_dir = ms_snapshot_download('xichen/cleansd', cache_dir='./modelscope')
|
29 |
print('=== Pretrained SD weights downloaded ===')
|
30 |
model_dir = ms_snapshot_download('xichen/MimicBrush', cache_dir='./modelscope')
|
31 |
print('=== MimicBrush weights downloaded ===')
|
32 |
+
|
33 |
val_configs = OmegaConf.load('./configs/inference.yaml')
|
34 |
|
35 |
# === import Depth Anything ===
|
|
|
177 |
mimicbrush_model = MimicBrush_RefNet(pipe, image_encoder_path, mimicbrush_ckpt, depth_anything_model, depth_guider, referencenet, device)
|
178 |
mask_processor = VaeImageProcessor(vae_scale_factor=1, do_normalize=False, do_binarize=True, do_convert_grayscale=True)
|
179 |
|
|
|
180 |
@spaces.GPU
|
181 |
def infer_single(ref_image, target_image, target_mask, seed = -1, num_inference_steps=50, guidance_scale = 5, enable_shape_control = False):
|
182 |
#return ref_image
|
|
|
365 |
outputs=[baseline_gallery]
|
366 |
)
|
367 |
|
368 |
+
demo.launch(server_name="0.0.0.0")
|