root commited on
Commit
a893db0
1 Parent(s): 5569753

textbox 2 text

Browse files
Files changed (1) hide show
  1. app.py +9 -12
app.py CHANGED
@@ -1,6 +1,6 @@
1
- import os
2
- os.system("pip uninstall -y gradio")
3
- os.system("pip install gradio==3.41.0")
4
 
5
  import os
6
  import copy
@@ -319,8 +319,7 @@ with gr.Blocks() as demo:
319
  with gr.Tab(label="2 Optimization"):
320
  with gr.Row():
321
  with gr.Column():
322
-
323
- #txt_box = gr.Textbox("Click the button to start optimization...", interactive = False)
324
 
325
  opt_flag = gr.State(0)
326
  gr.Markdown("""<p style="text-align: center; font-size: 20px">Optimization settings (SD)</p>""")
@@ -358,7 +357,7 @@ with gr.Blocks() as demo:
358
  )
359
  run_optimization()
360
  print('finish')
361
- #return gr.Button.update(value="Optimization finished!", interactive=False)
362
 
363
  def immediate_update():
364
  return gr.Button.update("Processing...", interactive=False)
@@ -378,14 +377,13 @@ with gr.Blocks() as demo:
378
  train_batch_size,
379
  gradient_accumulation_steps
380
  ],
381
- outputs = [])
382
  add_button.click(fn=immediate_update2, inputs=[], outputs=[add_button])
383
- add_button.update()
 
 
384
  '''txt_box.change(fn=lambda x: gr.Button.update(value="Optimization Finished!", interactive=True),
385
  inputs=[txt_box], outputs=[add_button])
386
-
387
- def change_text(txt_box):
388
- return gr.Textbox("Optimization Finished!", interactive = False)
389
  def change_text2():
390
  return gr.Textbox("Start optimization, check logs for progress...", interactive = False)
391
  add_button.click(change_text2, [], txt_box)'''
@@ -448,7 +446,6 @@ with gr.Blocks() as demo:
448
  outputs = [],queue=True,
449
  )
450
 
451
-
452
  load_button = gr.Button("Load results")
453
  load_button.click(load_pil_img,
454
  inputs = [],
 
1
+ # import os
2
+ # os.system("pip uninstall -y gradio")
3
+ # os.system("pip install gradio==3.41.0")
4
 
5
  import os
6
  import copy
 
319
  with gr.Tab(label="2 Optimization"):
320
  with gr.Row():
321
  with gr.Column():
322
+ result_info = gr.Text(label="Response")
 
323
 
324
  opt_flag = gr.State(0)
325
  gr.Markdown("""<p style="text-align: center; font-size: 20px">Optimization settings (SD)</p>""")
 
357
  )
358
  run_optimization()
359
  print('finish')
360
+ return "Optimization finished!"
361
 
362
  def immediate_update():
363
  return gr.Button.update("Processing...", interactive=False)
 
377
  train_batch_size,
378
  gradient_accumulation_steps
379
  ],
380
+ outputs = [result_info], api_name=False, concurrency_limit=45)
381
  add_button.click(fn=immediate_update2, inputs=[], outputs=[add_button])
382
+ #add_button.update()
383
+ def change_text():
384
+ return gr.Textbox.update("Optimization Finished!", interactive = False)
385
  '''txt_box.change(fn=lambda x: gr.Button.update(value="Optimization Finished!", interactive=True),
386
  inputs=[txt_box], outputs=[add_button])
 
 
 
387
  def change_text2():
388
  return gr.Textbox("Start optimization, check logs for progress...", interactive = False)
389
  add_button.click(change_text2, [], txt_box)'''
 
446
  outputs = [],queue=True,
447
  )
448
 
 
449
  load_button = gr.Button("Load results")
450
  load_button.click(load_pil_img,
451
  inputs = [],