Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -81,8 +81,13 @@ def process(input_image,
|
|
81 |
randomize_seed,
|
82 |
guidance_scale,
|
83 |
num_inference_steps):
|
|
|
84 |
if original_image is None:
|
85 |
-
|
|
|
|
|
|
|
|
|
86 |
if (original_mask is None or len(selected_points)==0) and input_mask is None:
|
87 |
raise gr.Error("Please click the region where you hope unchanged/changed, or upload a white-black Mask image")
|
88 |
|
@@ -176,8 +181,8 @@ with block:
|
|
176 |
with gr.Row():
|
177 |
with gr.Tabs(elem_classes=["feedback"]):
|
178 |
with gr.TabItem("Input Image"):
|
179 |
-
input_image = gr.Image(type="numpy", label="input",scale=2, height=
|
180 |
-
original_image = gr.State(value=None,label="index")
|
181 |
original_mask = gr.State(value=None)
|
182 |
selected_points = gr.State([],label="select points")
|
183 |
with gr.Row(elem_id="Seg"):
|
@@ -225,7 +230,7 @@ with block:
|
|
225 |
with gr.Row(elem_id="Image"):
|
226 |
with gr.Tabs(elem_classes=["feedback1"]):
|
227 |
with gr.TabItem("User-specified Mask Image (Optional)"):
|
228 |
-
input_mask = gr.Image(type="numpy", label="Mask Image", height=
|
229 |
|
230 |
with gr.Column():
|
231 |
with gr.Tabs(elem_classes=["feedback"]):
|
@@ -237,7 +242,7 @@ with block:
|
|
237 |
example = gr.Examples(
|
238 |
label="Input Example",
|
239 |
examples=image_examples,
|
240 |
-
inputs=[input_image, prompt, input_mask, original_image, selected_points,result_gallery],
|
241 |
outputs=[input_image, prompt, input_mask, original_image, selected_points],
|
242 |
fn=process_example,
|
243 |
run_on_click=True,
|
|
|
81 |
randomize_seed,
|
82 |
guidance_scale,
|
83 |
num_inference_steps):
|
84 |
+
|
85 |
if original_image is None:
|
86 |
+
if input_image:
|
87 |
+
original_image = input_image
|
88 |
+
original_mask = input_mask
|
89 |
+
else:
|
90 |
+
raise gr.Error('Please upload the input image')
|
91 |
if (original_mask is None or len(selected_points)==0) and input_mask is None:
|
92 |
raise gr.Error("Please click the region where you hope unchanged/changed, or upload a white-black Mask image")
|
93 |
|
|
|
181 |
with gr.Row():
|
182 |
with gr.Tabs(elem_classes=["feedback"]):
|
183 |
with gr.TabItem("Input Image"):
|
184 |
+
input_image = gr.Image(type="numpy", label="input",scale=2, height=1024)
|
185 |
+
original_image = gr.State(value=None, label="index")
|
186 |
original_mask = gr.State(value=None)
|
187 |
selected_points = gr.State([],label="select points")
|
188 |
with gr.Row(elem_id="Seg"):
|
|
|
230 |
with gr.Row(elem_id="Image"):
|
231 |
with gr.Tabs(elem_classes=["feedback1"]):
|
232 |
with gr.TabItem("User-specified Mask Image (Optional)"):
|
233 |
+
input_mask = gr.Image(type="numpy", label="Mask Image", height=1024)
|
234 |
|
235 |
with gr.Column():
|
236 |
with gr.Tabs(elem_classes=["feedback"]):
|
|
|
242 |
example = gr.Examples(
|
243 |
label="Input Example",
|
244 |
examples=image_examples,
|
245 |
+
inputs=[input_image, prompt, input_mask, original_image, selected_points, result_gallery],
|
246 |
outputs=[input_image, prompt, input_mask, original_image, selected_points],
|
247 |
fn=process_example,
|
248 |
run_on_click=True,
|