Spaces:
Runtime error
Runtime error
Update app.py
Browse filestry1 for GPU with state error: moving set_pipe outside of Blocks
app.py
CHANGED
@@ -31,6 +31,17 @@ pipe_inversion.scheduler_inference = scheduler_class.from_config(pipe_inference.
|
|
31 |
# image = editor.edit(target_prompt)
|
32 |
# return image
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
def edit(editor, target_prompt):
|
35 |
if editor is None:
|
36 |
raise gr.Error("Set inputs before editing.")
|
@@ -67,17 +78,6 @@ with gr.Blocks(css="style.css") as demo:
|
|
67 |
""")
|
68 |
editor_state = gr.State()
|
69 |
|
70 |
-
@spaces.GPU
|
71 |
-
def set_pipe(input_image, description_prompt, edit_guidance_scale, num_inference_steps=4,
|
72 |
-
num_inversion_steps=4, inversion_max_step=0.6, rnri_iterations=2, rnri_alpha=0.1, rnri_lr=0.2):
|
73 |
-
config = RunConfig(num_inference_steps=num_inference_steps,
|
74 |
-
num_inversion_steps=num_inversion_steps,
|
75 |
-
edit_guidance_scale=edit_guidance_scale,
|
76 |
-
inversion_max_step=inversion_max_step)
|
77 |
-
return ImageEditorDemo(pipe_inversion, pipe_inference, input_image,
|
78 |
-
description_prompt, config, device,
|
79 |
-
[rnri_iterations, rnri_alpha, rnri_lr]), "Input has set!"
|
80 |
-
|
81 |
gr.Markdown(f"""running on {power_device}""")
|
82 |
with gr.Row():
|
83 |
with gr.Column(elem_id="col-container-1"):
|
|
|
31 |
# image = editor.edit(target_prompt)
|
32 |
# return image
|
33 |
|
34 |
+
@spaces.GPU
|
35 |
+
def set_pipe(input_image, description_prompt, edit_guidance_scale, num_inference_steps=4,
|
36 |
+
num_inversion_steps=4, inversion_max_step=0.6, rnri_iterations=2, rnri_alpha=0.1, rnri_lr=0.2):
|
37 |
+
config = RunConfig(num_inference_steps=num_inference_steps,
|
38 |
+
num_inversion_steps=num_inversion_steps,
|
39 |
+
edit_guidance_scale=edit_guidance_scale,
|
40 |
+
inversion_max_step=inversion_max_step)
|
41 |
+
return ImageEditorDemo(pipe_inversion, pipe_inference, input_image,
|
42 |
+
description_prompt, config, device,
|
43 |
+
[rnri_iterations, rnri_alpha, rnri_lr]), "Input has set!"
|
44 |
+
|
45 |
def edit(editor, target_prompt):
|
46 |
if editor is None:
|
47 |
raise gr.Error("Set inputs before editing.")
|
|
|
78 |
""")
|
79 |
editor_state = gr.State()
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
gr.Markdown(f"""running on {power_device}""")
|
82 |
with gr.Row():
|
83 |
with gr.Column(elem_id="col-container-1"):
|