niulx commited on
Commit
a106f50
1 Parent(s): e0d2e28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -19
app.py CHANGED
@@ -176,8 +176,6 @@ with gr.Blocks() as demo:
176
  canvas = gr.Image(value = "./img.png", type="numpy", label="Draw Mask", show_label=True, height=LENGTH, width=LENGTH, interactive=True)
177
  result_info0 = gr.Text(label="Response")
178
  segment_button = gr.Button("Run segmentation")
179
-
180
-
181
 
182
  flag = gr.State(False)
183
 
@@ -201,16 +199,17 @@ with gr.Blocks() as demo:
201
 
202
  opt_flag = gr.State(0)
203
  gr.Markdown("""<p style="text-align: center; font-size: 20px">Optimization settings (SD)</p>""")
204
- num_tokens = gr.Number(value="5", label="num tokens to represent each object", interactive= True)
205
- num_tokens_global = num_tokens
206
- embedding_learning_rate = gr.Textbox(value="0.00005", label="Embedding optimization: Learning rate", interactive= True )
207
- max_emb_train_steps = gr.Number(value="15", label="embedding optimization: Training steps", interactive= True )
208
-
209
- diffusion_model_learning_rate = gr.Textbox(value="0.00002", label="UNet Optimization: Learning rate", interactive= True )
210
- max_diffusion_train_steps = gr.Number(value="10", label="UNet Optimization: Learning rate: Training steps", interactive= True )
211
-
212
- train_batch_size = gr.Number(value="20", label="Batch size", interactive= True )
213
- gradient_accumulation_steps=gr.Number(value="2", label="Gradient accumulation", interactive= True )
 
214
 
215
  add_button = gr.Button("Run optimization")
216
  def run_optimization_wrapper (
@@ -260,14 +259,14 @@ with gr.Blocks() as demo:
260
 
261
  with gr.Column():
262
  gr.Markdown("""<p style="text-align: center; font-size: 20px">Editing setting (SD)</p>""")
263
-
264
  tgt_prompt = gr.Textbox(value="White bag", label="Editing: Text prompt", interactive= True )
265
- slider2 = gr.Slider(0, 20, step=1, label = 'mask id', visible=False)
266
- #tgt_index = gr.Number(value="0", label="Editing: Object index", interactive= True )
267
- guidance_scale = gr.Textbox(value="6", label="Editing: CFG guidance scale", interactive= True )
268
- num_sampling_steps = gr.Number(value="50", label="Editing: Sampling steps", interactive= True )
269
- edge_thickness = gr.Number(value="10", label="Editing: Edge thickness", interactive= True )
270
- strength = gr.Textbox(value="0.5", label="Editing: Mask strength", interactive= True )
 
271
 
272
  add_button2 = gr.Button("Run Editing (Check log for progress.)",interactive = False)
273
  def run_edit_text_wrapper(
 
176
  canvas = gr.Image(value = "./img.png", type="numpy", label="Draw Mask", show_label=True, height=LENGTH, width=LENGTH, interactive=True)
177
  result_info0 = gr.Text(label="Response")
178
  segment_button = gr.Button("Run segmentation")
 
 
179
 
180
  flag = gr.State(False)
181
 
 
199
 
200
  opt_flag = gr.State(0)
201
  gr.Markdown("""<p style="text-align: center; font-size: 20px">Optimization settings (SD)</p>""")
202
+ with gr.Accordion(label="Advanced settings", open=False):
203
+ num_tokens = gr.Number(value="5", label="num tokens to represent each object", interactive= True)
204
+ num_tokens_global = num_tokens
205
+ embedding_learning_rate = gr.Textbox(value="0.00005", label="Embedding optimization: Learning rate", interactive= True )
206
+ max_emb_train_steps = gr.Number(value="15", label="embedding optimization: Training steps", interactive= True )
207
+
208
+ diffusion_model_learning_rate = gr.Textbox(value="0.00002", label="UNet Optimization: Learning rate", interactive= True )
209
+ max_diffusion_train_steps = gr.Number(value="10", label="UNet Optimization: Learning rate: Training steps", interactive= True )
210
+
211
+ train_batch_size = gr.Number(value="20", label="Batch size", interactive= True )
212
+ gradient_accumulation_steps=gr.Number(value="2", label="Gradient accumulation", interactive= True )
213
 
214
  add_button = gr.Button("Run optimization")
215
  def run_optimization_wrapper (
 
259
 
260
  with gr.Column():
261
  gr.Markdown("""<p style="text-align: center; font-size: 20px">Editing setting (SD)</p>""")
 
262
  tgt_prompt = gr.Textbox(value="White bag", label="Editing: Text prompt", interactive= True )
263
+ with gr.Accordion(label="Advanced settings", open=False):
264
+ slider2 = gr.Slider(0, 20, step=1, label = 'mask id', visible=False)
265
+ #tgt_index = gr.Number(value="0", label="Editing: Object index", interactive= True )
266
+ guidance_scale = gr.Textbox(value="6", label="Editing: CFG guidance scale", interactive= True )
267
+ num_sampling_steps = gr.Number(value="50", label="Editing: Sampling steps", interactive= True )
268
+ edge_thickness = gr.Number(value="10", label="Editing: Edge thickness", interactive= True )
269
+ strength = gr.Textbox(value="0.5", label="Editing: Mask strength", interactive= True )
270
 
271
  add_button2 = gr.Button("Run Editing (Check log for progress.)",interactive = False)
272
  def run_edit_text_wrapper(