Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 440 |
-
p.join()
|
| 441 |
-
|
|
|
|
|
|
|
|
|
|
| 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
|