Spaces:
Runtime error
Runtime error
Update gradio_demo.py
Browse files- gradio_demo.py +6 -6
gradio_demo.py
CHANGED
@@ -74,7 +74,7 @@ model.eval()
|
|
74 |
# Change UNet
|
75 |
|
76 |
with torch.no_grad():
|
77 |
-
new_conv_in = torch.nn.Conv2d(
|
78 |
new_conv_in.weight.zero_()
|
79 |
new_conv_in.weight[:, :4, :, :].copy_(unet.conv_in.weight)
|
80 |
new_conv_in.bias = unet.conv_in.bias
|
@@ -129,12 +129,12 @@ unet.forward = hooked_unet_forward
|
|
129 |
|
130 |
# Load
|
131 |
|
132 |
-
model_path = './models/iclight_sd15_fc.safetensors'
|
133 |
-
|
134 |
|
135 |
|
136 |
if not os.path.exists(model_path):
|
137 |
-
download_url_to_file(url='https://huggingface.co/lllyasviel/ic-light/resolve/main/
|
138 |
|
139 |
sd_offset = sf.load_file(model_path)
|
140 |
sd_origin = unet.state_dict()
|
@@ -763,7 +763,7 @@ def compress_image(image):
|
|
763 |
|
764 |
block = gr.Blocks().queue()
|
765 |
with block:
|
766 |
-
with gr.Tab("Text"):
|
767 |
with gr.Row():
|
768 |
gr.Markdown("## Product Placement from Text")
|
769 |
with gr.Row():
|
@@ -815,7 +815,7 @@ with block:
|
|
815 |
example_quick_prompts.click(lambda x, y: ', '.join(y.split(', ')[:2] + [x[0]]), inputs=[example_quick_prompts, prompt], outputs=prompt, show_progress=False, queue=False)
|
816 |
example_quick_subjects.click(lambda x: x[0], inputs=example_quick_subjects, outputs=prompt, show_progress=False, queue=False)
|
817 |
|
818 |
-
with gr.Tab("Background", visible=
|
819 |
mask_mover = MaskMover()
|
820 |
|
821 |
|
|
|
74 |
# Change UNet
|
75 |
|
76 |
with torch.no_grad():
|
77 |
+
new_conv_in = torch.nn.Conv2d(12, unet.conv_in.out_channels, unet.conv_in.kernel_size, unet.conv_in.stride, unet.conv_in.padding)
|
78 |
new_conv_in.weight.zero_()
|
79 |
new_conv_in.weight[:, :4, :, :].copy_(unet.conv_in.weight)
|
80 |
new_conv_in.bias = unet.conv_in.bias
|
|
|
129 |
|
130 |
# Load
|
131 |
|
132 |
+
#model_path = './models/iclight_sd15_fc.safetensors'
|
133 |
+
model_path = './models/iclight_sd15_fbc.safetensors'
|
134 |
|
135 |
|
136 |
if not os.path.exists(model_path):
|
137 |
+
download_url_to_file(url='https://huggingface.co/lllyasviel/ic-light/resolve/main/iclight_sd15_fbc.safetensors', dst=model_path)
|
138 |
|
139 |
sd_offset = sf.load_file(model_path)
|
140 |
sd_origin = unet.state_dict()
|
|
|
763 |
|
764 |
block = gr.Blocks().queue()
|
765 |
with block:
|
766 |
+
with gr.Tab("Text", visible=False):
|
767 |
with gr.Row():
|
768 |
gr.Markdown("## Product Placement from Text")
|
769 |
with gr.Row():
|
|
|
815 |
example_quick_prompts.click(lambda x, y: ', '.join(y.split(', ')[:2] + [x[0]]), inputs=[example_quick_prompts, prompt], outputs=prompt, show_progress=False, queue=False)
|
816 |
example_quick_subjects.click(lambda x: x[0], inputs=example_quick_subjects, outputs=prompt, show_progress=False, queue=False)
|
817 |
|
818 |
+
with gr.Tab("Background", visible=True):
|
819 |
mask_mover = MaskMover()
|
820 |
|
821 |
|