Spaces:
Running
Running
instant cancel during preprocessing (dont wait for thread to finish)
Browse files
app.py
CHANGED
|
@@ -811,6 +811,11 @@ def gradio_main():
|
|
| 811 |
t.start()
|
| 812 |
while t.is_alive():
|
| 813 |
t.join(timeout=3)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 814 |
if len(_train_log_lines) > _preprocess_log_len:
|
| 815 |
_preprocess_log_len = len(_train_log_lines)
|
| 816 |
yield _log_text(), gr.Button(visible=False), gr.Button(visible=True), gr.File()
|
|
@@ -819,12 +824,6 @@ def gradio_main():
|
|
| 819 |
raise _preprocess_error[0]
|
| 820 |
result = _preprocess_result[0]
|
| 821 |
|
| 822 |
-
if _training_cancel.is_set():
|
| 823 |
-
_training_cancel.clear()
|
| 824 |
-
_log("[CANCELLED] Stopped during preprocessing")
|
| 825 |
-
yield _log_text(), gr.Button(visible=True), gr.Button(visible=False), gr.File()
|
| 826 |
-
return
|
| 827 |
-
|
| 828 |
processed = result.get("processed", 0)
|
| 829 |
failed = result.get("failed", 0)
|
| 830 |
total = result.get("total", 0)
|
|
|
|
| 811 |
t.start()
|
| 812 |
while t.is_alive():
|
| 813 |
t.join(timeout=3)
|
| 814 |
+
if _training_cancel.is_set():
|
| 815 |
+
_training_cancel.clear()
|
| 816 |
+
_log("[CANCELLED] Stopped during preprocessing")
|
| 817 |
+
yield _log_text(), gr.Button(visible=True), gr.Button(visible=False), gr.File()
|
| 818 |
+
return
|
| 819 |
if len(_train_log_lines) > _preprocess_log_len:
|
| 820 |
_preprocess_log_len = len(_train_log_lines)
|
| 821 |
yield _log_text(), gr.Button(visible=False), gr.Button(visible=True), gr.File()
|
|
|
|
| 824 |
raise _preprocess_error[0]
|
| 825 |
result = _preprocess_result[0]
|
| 826 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 827 |
processed = result.get("processed", 0)
|
| 828 |
failed = result.get("failed", 0)
|
| 829 |
total = result.get("total", 0)
|