VyLala commited on
Commit
993f2e0
Β·
verified Β·
1 Parent(s): 507a47c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -435,12 +435,19 @@ with gr.Blocks() as interface:
435
  return False, None
436
 
437
  # Stop flag check
 
 
 
 
 
438
  if stop_value is not None and stop_value.value:
439
- p.terminate()
440
- p.join()
441
- print("πŸ›‘ Stop flag detected β€” function killed early.")
 
 
 
442
  return False, None
443
-
444
  time.sleep(0.1) # avoid busy waiting
445
 
446
  # Process finished naturally
 
435
  return False, None
436
 
437
  # Stop flag check
438
+ # if stop_value is not None and stop_value.value:
439
+ # p.terminate()
440
+ # p.join()
441
+ # print("πŸ›‘ Stop flag detected β€” function killed early.")
442
+ # return False, None
443
  if stop_value is not None and stop_value.value:
444
+ print("πŸ›‘ Stop flag detected β€” waiting for child to exit gracefully.")
445
+ p.join(timeout=3) # short wait for graceful exit
446
+ if p.is_alive():
447
+ print("⚠️ Child still alive, forcing termination.")
448
+ p.terminate()
449
+ p.join()
450
  return False, None
 
451
  time.sleep(0.1) # avoid busy waiting
452
 
453
  # Process finished naturally