Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -173,7 +173,11 @@ import shutil
|
|
173 |
if os.path.isdir("./example_tmp"):
|
174 |
shutil.rmtree("./example_tmp")
|
175 |
|
|
|
176 |
from segment import run_segmentation
|
|
|
|
|
|
|
177 |
with gr.Blocks() as demo:
|
178 |
image = gr.State() # store mask
|
179 |
image_loaded = gr.State()
|
@@ -204,8 +208,9 @@ with gr.Blocks() as demo:
|
|
204 |
# mask_np_list_updated.value = copy.deepcopy(mask_np_list.value) #!!
|
205 |
mask_np_list_updated = mask_np_list
|
206 |
with gr.Column():
|
|
|
207 |
gr.Markdown("""<p style="text-align: center; font-size: 20px">Edit Mask (Optional)</p>""")
|
208 |
-
slider
|
209 |
label = gr.Textbox()
|
210 |
slider.release(slider_release,
|
211 |
inputs = [slider, image_loaded, mask_np_list_updated, mask_label_list],
|
@@ -214,7 +219,7 @@ with gr.Blocks() as demo:
|
|
214 |
|
215 |
segment_button.click(run_segmentation,
|
216 |
[canvas] ,
|
217 |
-
[text_button] )
|
218 |
text_button.click(load_image_ui, [false] ,
|
219 |
[image_loaded, segmentation, mask_np_list, mask_label_list, canvas, slider] )
|
220 |
|
@@ -302,7 +307,8 @@ with gr.Blocks() as demo:
|
|
302 |
gr.Markdown("""<p style="text-align: center; font-size: 20px">Editing setting (SD)</p>""")
|
303 |
|
304 |
tgt_prompt = gr.Textbox(value="White bag", label="Editing: Text prompt", interactive= True )
|
305 |
-
|
|
|
306 |
guidance_scale = gr.Textbox(value="6", label="Editing: CFG guidance scale", interactive= True )
|
307 |
num_sampling_steps = gr.Number(value="50", label="Editing: Sampling steps", interactive= True )
|
308 |
edge_thickness = gr.Number(value="10", label="Editing: Edge thickness", interactive= True )
|
@@ -342,7 +348,7 @@ with gr.Blocks() as demo:
|
|
342 |
strength ,
|
343 |
edge_thickness,
|
344 |
tgt_prompt ,
|
345 |
-
|
346 |
],
|
347 |
outputs = [canvas_text_edit],queue=True,
|
348 |
)
|
|
|
173 |
if os.path.isdir("./example_tmp"):
|
174 |
shutil.rmtree("./example_tmp")
|
175 |
|
176 |
+
|
177 |
from segment import run_segmentation
|
178 |
+
|
179 |
+
slider = gr.Slider(0, 20, step=1, label = 'mask id', interactive=False)
|
180 |
+
|
181 |
with gr.Blocks() as demo:
|
182 |
image = gr.State() # store mask
|
183 |
image_loaded = gr.State()
|
|
|
208 |
# mask_np_list_updated.value = copy.deepcopy(mask_np_list.value) #!!
|
209 |
mask_np_list_updated = mask_np_list
|
210 |
with gr.Column():
|
211 |
+
result_info0 = gr.Text(label="Response")
|
212 |
gr.Markdown("""<p style="text-align: center; font-size: 20px">Edit Mask (Optional)</p>""")
|
213 |
+
slider.render()
|
214 |
label = gr.Textbox()
|
215 |
slider.release(slider_release,
|
216 |
inputs = [slider, image_loaded, mask_np_list_updated, mask_label_list],
|
|
|
219 |
|
220 |
segment_button.click(run_segmentation,
|
221 |
[canvas] ,
|
222 |
+
[text_button,result_info0] )
|
223 |
text_button.click(load_image_ui, [false] ,
|
224 |
[image_loaded, segmentation, mask_np_list, mask_label_list, canvas, slider] )
|
225 |
|
|
|
307 |
gr.Markdown("""<p style="text-align: center; font-size: 20px">Editing setting (SD)</p>""")
|
308 |
|
309 |
tgt_prompt = gr.Textbox(value="White bag", label="Editing: Text prompt", interactive= True )
|
310 |
+
slider.render()
|
311 |
+
#tgt_index = gr.Number(value="0", label="Editing: Object index", interactive= True )
|
312 |
guidance_scale = gr.Textbox(value="6", label="Editing: CFG guidance scale", interactive= True )
|
313 |
num_sampling_steps = gr.Number(value="50", label="Editing: Sampling steps", interactive= True )
|
314 |
edge_thickness = gr.Number(value="10", label="Editing: Edge thickness", interactive= True )
|
|
|
348 |
strength ,
|
349 |
edge_thickness,
|
350 |
tgt_prompt ,
|
351 |
+
slider
|
352 |
],
|
353 |
outputs = [canvas_text_edit],queue=True,
|
354 |
)
|