Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,6 @@ pipeline.enable_model_cpu_offload()
|
|
23 |
pipeline.enable_vae_slicing()
|
24 |
|
25 |
def run(ref_path, ref_style, ref_prompt, prompt1, prompt2, prompt3):
|
26 |
-
|
27 |
# DDIM inversion
|
28 |
src_style = f"{ref_style}"
|
29 |
src_prompt = f"{ref_prompt}, {src_style}."
|
@@ -31,7 +30,11 @@ def run(ref_path, ref_style, ref_prompt, prompt1, prompt2, prompt3):
|
|
31 |
|
32 |
num_inference_steps = 50
|
33 |
x0 = np.array(load_image(image_path).resize((1024, 1024)))
|
34 |
-
|
|
|
|
|
|
|
|
|
35 |
#mediapy.show_image(x0, title="innput reference image", height=256)
|
36 |
|
37 |
# run StyleAligned
|
@@ -88,7 +91,7 @@ with gr.Blocks() as demo:
|
|
88 |
with gr.Column():
|
89 |
ref_path = gr.Image(type="filepath", value="./example_image/medieval-bed.jpeg")
|
90 |
ref_style = gr.Textbox(label="Reference style", value="medieval painting")
|
91 |
-
ref_prompt = gr.Textbox(label="
|
92 |
|
93 |
with gr.Column():
|
94 |
|
|
|
23 |
pipeline.enable_vae_slicing()
|
24 |
|
25 |
def run(ref_path, ref_style, ref_prompt, prompt1, prompt2, prompt3):
|
|
|
26 |
# DDIM inversion
|
27 |
src_style = f"{ref_style}"
|
28 |
src_prompt = f"{ref_prompt}, {src_style}."
|
|
|
30 |
|
31 |
num_inference_steps = 50
|
32 |
x0 = np.array(load_image(image_path).resize((1024, 1024)))
|
33 |
+
|
34 |
+
try:
|
35 |
+
zts = inversion.ddim_inversion(pipeline, x0, src_prompt, num_inference_steps, 2)
|
36 |
+
except:
|
37 |
+
zts = inversion.ddim_inversion(pipeline, x0, src_prompt, num_inference_steps, 2)
|
38 |
#mediapy.show_image(x0, title="innput reference image", height=256)
|
39 |
|
40 |
# run StyleAligned
|
|
|
91 |
with gr.Column():
|
92 |
ref_path = gr.Image(type="filepath", value="./example_image/medieval-bed.jpeg")
|
93 |
ref_style = gr.Textbox(label="Reference style", value="medieval painting")
|
94 |
+
ref_prompt = gr.Textbox(label="Reference prompt", value="Man laying on bed")
|
95 |
|
96 |
with gr.Column():
|
97 |
|