Spaces:
Runtime error
Runtime error
Update app.py
Browse filesmoving editor to cpu before forwarding to State.
app.py
CHANGED
@@ -72,14 +72,18 @@ with gr.Blocks(css="style.css") as demo:
|
|
72 |
inversion_max_step=inversion_max_step)
|
73 |
image_editor = ImageEditorDemo(pipe_inversion, pipe_inference, input_image,
|
74 |
description_prompt, config, device,
|
75 |
-
[rnri_iterations, rnri_alpha, rnri_lr])
|
76 |
return image_editor, "Input has set!"
|
77 |
|
78 |
@spaces.GPU
|
79 |
def edit(editor, target_prompt):
|
80 |
if editor is None:
|
81 |
raise gr.Error("Set inputs before editing.")
|
82 |
-
|
|
|
|
|
|
|
|
|
83 |
|
84 |
gr.Markdown(f"""running on {power_device}""")
|
85 |
with gr.Row():
|
|
|
72 |
inversion_max_step=inversion_max_step)
|
73 |
image_editor = ImageEditorDemo(pipe_inversion, pipe_inference, input_image,
|
74 |
description_prompt, config, device,
|
75 |
+
[rnri_iterations, rnri_alpha, rnri_lr]).to('cpu')
|
76 |
return image_editor, "Input has set!"
|
77 |
|
78 |
@spaces.GPU
|
79 |
def edit(editor, target_prompt):
|
80 |
if editor is None:
|
81 |
raise gr.Error("Set inputs before editing.")
|
82 |
+
if device == "cuda":
|
83 |
+
image = editor.to(device).edit(target_prompt)
|
84 |
+
else:
|
85 |
+
image = editor.edit(target_prompt)
|
86 |
+
return image
|
87 |
|
88 |
gr.Markdown(f"""running on {power_device}""")
|
89 |
with gr.Row():
|