root commited on
Commit
6078194
1 Parent(s): f5b4485

add example imgs

Browse files
Files changed (3) hide show
  1. app.py +5 -5
  2. img3.png +0 -0
  3. img4.png +0 -0
app.py CHANGED
@@ -190,7 +190,7 @@ with gr.Blocks() as demo:
190
  with gr.Row():
191
  with gr.Column():
192
  canvas = gr.Image(value = "./img.png", type="numpy", label="Draw Mask", show_label=True, height=LENGTH, width=LENGTH, interactive=True)
193
- gr.Markdown("""<p style="text-align: left; font-size: 16px">Each image requires a single segmentation and optimization operation.<br>Afterwards, you can modify the mask ID and prompt for image editing. <br>The D-edit link is: https://arxiv.org/abs/2403.04880v2"</p>""")
194
 
195
  with gr.Column():
196
  result_info0 = gr.Text(label="Response")
@@ -199,7 +199,7 @@ with gr.Blocks() as demo:
199
 
200
  # mask_np_list_updated.value = copy.deepcopy(mask_np_list.value) #!!
201
  mask_np_list_updated = mask_np_list
202
- gr.Markdown("""<p style="text-align: center; font-size: 20px">Edit Mask (Optional)</p>""")
203
  slider = gr.Slider(0, 20, step=1, label = 'mask id', visible=False)
204
  label = gr.Text(label='label')
205
 
@@ -211,7 +211,7 @@ with gr.Blocks() as demo:
211
  result_info = gr.Text(label="Response")
212
 
213
  opt_flag = gr.State(0)
214
- gr.Markdown("""<p style="text-align: center; font-size: 20px">Optimization settings (SD)</p>""")
215
  with gr.Accordion(label="Advanced settings", open=False):
216
  num_tokens = gr.Number(value="5", label="num tokens to represent each object", interactive= True)
217
  num_tokens_global = num_tokens
@@ -271,7 +271,7 @@ with gr.Blocks() as demo:
271
  # canvas_text_edit = gr.Gallery(label = "Edited results")
272
 
273
  with gr.Column():
274
- gr.Markdown("""<p style="text-align: center; font-size: 20px">Editing setting (SD)</p>""")
275
  tgt_prompt = gr.Textbox(value="text prompt", label="Editing: Text prompt", interactive= True )
276
  with gr.Accordion(label="Advanced settings", open=False):
277
  slider2 = gr.Slider(0, 20, step=1, label = 'mask id', visible=False)
@@ -314,7 +314,7 @@ with gr.Blocks() as demo:
314
  gr.Info('Image editing completed.')
315
  return load_pil_img()
316
 
317
- example_inps = [['./img.png'],['./img2.png'],['./img3.png']]
318
  gr.Examples(examples=example_inps, inputs=[canvas],
319
  label='examples', cache_examples='lazy', outputs=[],
320
  fn=change_image)
 
190
  with gr.Row():
191
  with gr.Column():
192
  canvas = gr.Image(value = "./img.png", type="numpy", label="Draw Mask", show_label=True, height=LENGTH, width=LENGTH, interactive=True)
193
+ gr.Markdown("""<p style="text-align: left; font-size: 16px">Each image requires a single segmentation and optimization operation.<br>Afterwards, you can modify the mask ID and prompt for image editing. <br>The link of D-edit paper: https://arxiv.org/abs/2403.04880v2</p>""")
194
 
195
  with gr.Column():
196
  result_info0 = gr.Text(label="Response")
 
199
 
200
  # mask_np_list_updated.value = copy.deepcopy(mask_np_list.value) #!!
201
  mask_np_list_updated = mask_np_list
202
+ gr.Markdown("""<p style="text-align: center; font-size: 20px">Edit Mask (Do not change it during the optimization)</p>""")
203
  slider = gr.Slider(0, 20, step=1, label = 'mask id', visible=False)
204
  label = gr.Text(label='label')
205
 
 
211
  result_info = gr.Text(label="Response")
212
 
213
  opt_flag = gr.State(0)
214
+ gr.Markdown("""<p style="text-align: center; font-size: 20px">Optimization settings</p>""")
215
  with gr.Accordion(label="Advanced settings", open=False):
216
  num_tokens = gr.Number(value="5", label="num tokens to represent each object", interactive= True)
217
  num_tokens_global = num_tokens
 
271
  # canvas_text_edit = gr.Gallery(label = "Edited results")
272
 
273
  with gr.Column():
274
+ gr.Markdown("""<p style="text-align: center; font-size: 20px">Editing setting</p>""")
275
  tgt_prompt = gr.Textbox(value="text prompt", label="Editing: Text prompt", interactive= True )
276
  with gr.Accordion(label="Advanced settings", open=False):
277
  slider2 = gr.Slider(0, 20, step=1, label = 'mask id', visible=False)
 
314
  gr.Info('Image editing completed.')
315
  return load_pil_img()
316
 
317
+ example_inps = [['./img.png'],['./img2.png'],['./img3.png'],['./img4.png']]
318
  gr.Examples(examples=example_inps, inputs=[canvas],
319
  label='examples', cache_examples='lazy', outputs=[],
320
  fn=change_image)
img3.png CHANGED
img4.png ADDED