Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -884,6 +884,18 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 884 |
capture_exception(e)
|
| 885 |
return create_empty_error_outputs(str(e))
|
| 886 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 887 |
# If the GPU scheduler threw, we already wrote the text into the log.
|
| 888 |
# Just read the tail once more so it reaches the UI textbox.
|
| 889 |
with open(log_file, "r", encoding="utf-8") as lf:
|
|
@@ -901,11 +913,19 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 901 |
except Exception as e:
|
| 902 |
capture_exception(e)
|
| 903 |
|
| 904 |
-
if
|
| 905 |
-
|
| 906 |
-
|
| 907 |
-
|
| 908 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 909 |
log_output += (
|
| 910 |
"\nAutoforge process completed successfully!"
|
| 911 |
if return_code == 0
|
|
|
|
| 884 |
capture_exception(e)
|
| 885 |
return create_empty_error_outputs(str(e))
|
| 886 |
|
| 887 |
+
if getattr(worker, "exc", None) is not None:
|
| 888 |
+
# worker.exc will be the ZeroGPU / scheduler error
|
| 889 |
+
err_msg = f"GPU run failed: {worker.exc}"
|
| 890 |
+
log_output += f"\n{err_msg}\n"
|
| 891 |
+
gr.Error(err_msg) # toast
|
| 892 |
+
yield ( # push the message into the textbox
|
| 893 |
+
"".join(log_output),
|
| 894 |
+
_maybe_new_preview(),
|
| 895 |
+
gr.update(),
|
| 896 |
+
)
|
| 897 |
+
return # stop the coroutine cleanly
|
| 898 |
+
|
| 899 |
# If the GPU scheduler threw, we already wrote the text into the log.
|
| 900 |
# Just read the tail once more so it reaches the UI textbox.
|
| 901 |
with open(log_file, "r", encoding="utf-8") as lf:
|
|
|
|
| 913 |
except Exception as e:
|
| 914 |
capture_exception(e)
|
| 915 |
|
| 916 |
+
if worker.returncode != 0:
|
| 917 |
+
err_msg = (
|
| 918 |
+
f"Autoforge exited with code {worker.returncode}\n"
|
| 919 |
+
"See the console output above for details."
|
| 920 |
+
)
|
| 921 |
+
log_output += f"\n{err_msg}\n"
|
| 922 |
+
gr.Error(err_msg)
|
| 923 |
+
yield (
|
| 924 |
+
"".join(log_output),
|
| 925 |
+
_maybe_new_preview(),
|
| 926 |
+
gr.update(),
|
| 927 |
+
)
|
| 928 |
+
return
|
| 929 |
log_output += (
|
| 930 |
"\nAutoforge process completed successfully!"
|
| 931 |
if return_code == 0
|