DemiPoto commited on
Commit
ac95a3c
·
verified ·
1 Parent(s): d4ed1d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -337,7 +337,9 @@ def fonc_load_gallery(id_session,gallery):
337
  gallery=add_gallery(cache_image[f"{id_session}"][i],cache_image[f"{id_session}"][i]["model"],gallery)
338
  return gallery
339
 
340
- def fonc_start(id_session,id_module,s):
 
 
341
  task_actu={}
342
  model_actu=""
343
  print("in fonc\n")
@@ -476,6 +478,10 @@ def make_me():
476
  nb_req_simult_max_by_mod=gr.Number(2,"Number max simultaneous request by model")
477
 
478
  button_start=gr.Button("START")
 
 
 
 
479
  with gr.Row():
480
  outputs=[]
481
  id_modules=[]
@@ -491,7 +497,7 @@ def make_me():
491
  for o,i,s in zip(outputs,id_modules,states):
492
  #o.change(fonc_start,[id_session,i],[o])
493
  #o.change(test_change,[],[])
494
- s.change(fonc_start,[id_session,i,s],[o,s])
495
  #button_start.click(lambda : gr.Image(None),[],[o])
496
  gen_event = gr.on(triggers=[button_start.click], fn=test_start,inputs=[s], outputs=[s])
497
 
 
337
  gallery=add_gallery(cache_image[f"{id_session}"][i],cache_image[f"{id_session}"][i]["model"],gallery)
338
  return gallery
339
 
340
+ def fonc_start(id_session,id_module,s,cont):
341
+ if cont==False:
342
+ return None,gr.Textbox(s)
343
  task_actu={}
344
  model_actu=""
345
  print("in fonc\n")
 
478
  nb_req_simult_max_by_mod=gr.Number(2,"Number max simultaneous request by model")
479
 
480
  button_start=gr.Button("START")
481
+ button_stop=gr.Button("STOP")
482
+ cont=gr.Radio(True,visible=False)
483
+ button_start.click(lambda:True,[],[cont])
484
+ button_stop.click(lambda:False,[],[cont])
485
  with gr.Row():
486
  outputs=[]
487
  id_modules=[]
 
497
  for o,i,s in zip(outputs,id_modules,states):
498
  #o.change(fonc_start,[id_session,i],[o])
499
  #o.change(test_change,[],[])
500
+ s.change(fonc_start,[id_session,i,s,cont],[o,s])
501
  #button_start.click(lambda : gr.Image(None),[],[o])
502
  gen_event = gr.on(triggers=[button_start.click], fn=test_start,inputs=[s], outputs=[s])
503